LoginSignup
30
25

More than 5 years have passed since last update.

Xcode 9で気がついたPlaygroundの変更点

Last updated at Posted at 2015-11-08

はじめに

Xcode 9(Swift 4)でPlaygroundの一部の記述方法が変わっていたようなので覚書

作成したViewをタイムラインに表示する

PlaygroundでUIViewを表示したい場合に使用します。

XCPlaygroundPage.currentPage.liveView = view

新しい書き方は以下のとおりです。

PlaygroundPage.current.liveView = view

非同期処理の許可

Playgroundで通信処理などを実行したい場合に使用します。

XCPlaygroundPage.currentPage.needsIndefiniteExecution = true

新しい書き方は以下のとおりです。

PlaygroundPage.current.needsIndefiniteExecution = true

上記のPlaygroundPageを使用するためのインポート

import XCPlayground

新しい書き方は以下のとおりです。

import PlaygroundSupport
30
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30
25