Polymorphism in Swift 3: manipulate multiple related controls with one IBOutlet and one IBAction

How would you enable or disable multiple user interface controls using one IBOutlet and one IBAction? For example, you might need to disable a UITextBox and UISegmentedControl because a user’s login has expired. Perhaps a user hasn’t filled in some required fields on a form, so you want to disable several buttons. Watch the following video to see how I built a Swift 3 app to use a UISwitch to enable or disable four controls all at one time — and I demonstrated the object-oriented programming (OOP) principle of polymorphism:

Refresh your memory about OOP and inheritance.

Continue reading “Polymorphism in Swift 3: manipulate multiple related controls with one IBOutlet and one IBAction”