Does swift playground support UIKit?

前端 未结 10 1186
花落未央
花落未央 2020-12-07 23:54

I tried to create a UILabel in playground but failed. Does playground only support OS X development for now?

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 00:48

    Edited@2014-11-13: It seems the new xcode 6 had fixed this.

    NO, It doesn't. But it's worth noting that you can import UIKit.

    If you want to import UIKit you cound follow this:

    1. View -> Utilities -> Show File Inspector (opt + cmd + 1)
    2. On the right side of Xcode Change “Playground Settings -> Platform” from OS X to iOS

    then you could import UIKit or some module for iOS

    ps. I try to create a UIImageView but it doesn't show the correct image on the right side. It seem worthless to import UIKit

提交回复
热议问题