Skip to content

Instantly share code, notes, and snippets.

@yabenatti
Created September 26, 2020 16:11
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 yabenatti/4ef62a5e67c44335ed5b932cf55fd252 to your computer and use it in GitHub Desktop.
Save yabenatti/4ef62a5e67c44335ed5b932cf55fd252 to your computer and use it in GitHub Desktop.
ConstraintViewController
import UIKit
class ViewController: UIViewController {
let titleLabel: UILabel = {
let label = UILabel()
label.text = "Hello Constraints"
label.backgroundColor = .red
label.translatesAutoresizingMaskIntoConstraints = false
return label
}()
let hiButton: UIButton = {
let button = UIButton()
button.setTitle("Hi!", for: .normal)
button.backgroundColor = .blue
button.translatesAutoresizingMaskIntoConstraints = false
return button
}()
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
// CALL ONE OF THE SETUPS HERE
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment