Skip to content

Instantly share code, notes, and snippets.

@enomoto
Last active May 9, 2019 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enomoto/a60e076fe426863813f1120e64545a5f to your computer and use it in GitHub Desktop.
Save enomoto/a60e076fe426863813f1120e64545a5f to your computer and use it in GitHub Desktop.
Playground Driven Development (Xcode 10.2.1, Swift 5)
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyViewController : UIViewController {
override func loadView() {
let view = UIView()
view.backgroundColor = .white
let label = UILabel()
label.frame = CGRect(x: 150, y: 200, width: 200, height: 20)
label.text = "Hello World!"
label.textColor = .black
view.addSubview(label)
self.view = view
}
}
// Present the view controller in the Live View window
PlaygroundPage.current.liveView = MyViewController()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment