I can't figure out how to create and display a live view in an Xcode 8/Swift 3 Playground. If Apple has comprehensive documentation on playgrounds and live views, I can't find it, and all my searching online reveals either tutorials on Xcode 7 or the new iPad playgrounds. The few examples I have found set up Mac OS views, which is not what I want (I work mostly in iOS, so the code I want to test out is iOS code, dealing with iOS view hierarchies.)
Can somebody give me the bare minimum setup to create a live view and install views into it from an Xcode 8 playground?
Then, can somebody point me to some good documentation on playgrounds, and how you configure and use them?
It works like this:
import UIKit
import PlaygroundSupport
let view = UIView(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
view.backgroundColor = UIColor.red
PlaygroundPage.current.liveView = view
Unfortunately I'm not aware of a good documentation. But I believe there is a book by Erica Sadun about Playgrounds.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With