Using didSet on Swift properties to clean up viewDidLoad
We have all seen those big view controllers and especially viewDidLoad functions with a whole bunch of set up code in them. Well, there is a very simple idea you can use to clean at least some of it up and make things more readable in the process.
On properties, we can use didSet as a place to put our setup code in. In this video, I’ll refactor a few simple set up lines of code back up into the IBOutlets and away from the view controller load function.
Back