Initialize attributes in didSet

suggest change
@IBOutlet weak var title: UILabel! {
  didSet {
    label.textColor = UIColor.redColor()
    label.font = UIFont.systemFontOfSize(20)
    label.backgroundColor = UIColor.blueColor()

It’s also possible to both set a value and initialize it:

private var loginButton = UIButton() {
    didSet(oldValue) {
        loginButton.addTarget(self, action: #selector(LoginController.didClickLogin), forControlEvents: .TouchUpInside)

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents