未処分利益

日記 メモ 映画 小説 感想 読書 Android iOS

PlaygroundでUIKitをimportできるようにする

Playground

Playground

PlaygroundでUIKitをimportするためのメモです。

初回にPlaygroundファイルを作成した際にどうしても

import UIKit

をすると下記のような

Playground execution failed: error: <REPL>:3:8: error: no such module 'UIKit'
import UIKit

エラーが出てUIKitのモジュールにアクセスできず小一時間悩みましたが、外人さん達の資料を見ていたら解決

Xcodeより

View -> Utilities -> Show File Inspector

からPlayground Settings のPlatformを「OSX」から「iOS」に 変えることでUIKitがimportできるようになりました。

(その代わりにimport Cocoaができなくなります)

以上、Playgroundの簡単なtipsでした。