Group outlets in a custom NSObject

suggest change

Move every outlet to an NSObject. Then drag an Object from the library to the controller scene of the storyboard, set its class to ContactFormStyle, and connect the elements there. The sample is Swift 2 (systemFontOfSize, blackColor()). A private outlet can be invisible to Interface Builder.

class ContactFormStyle: NSObject 
{
    @IBOutlet private weak var message: UILabel! {
      didSet {
        message.font = UIFont.systemFontOfSize(12)
        message.textColor = UIColor.blackColor()
      }
    }
}

class ContactFormVC: UIViewController 
{
    @IBOutlet private var style: ContactFormStyle!
}

Feedback about page:

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



Table Of Contents