Skip to content

Instantly share code, notes, and snippets.

@ryanmeisters
Created October 2, 2018 21:19
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 ryanmeisters/ecdfc7e2146ce9acea8b85abf3a8e76c to your computer and use it in GitHub Desktop.
Save ryanmeisters/ecdfc7e2146ce9acea8b85abf3a8e76c to your computer and use it in GitHub Desktop.
private lazy var actionButton: UIButton = UIButton.create {
// Do
$0.backgroundColor = .blue
$0.setTitle(.., for: .normal)
// maybe add own constraints?
constrainSquare($0, withSideLength: 40)
// Don't
self.view.addSubview($0)
$0.reactive.pressed = Action...
}
override func viewDidLoad() {
super.viewDidLoad()
// Add subview and hook up actions at explicit time
view.addSubview(actionButton)
actionButton.reactive.pressed = ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment