Using didSet on Swift properties to clean up viewDidLoad

Published: 12 September 2020
on channel: Peter Witham
86
4

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.

#swift #appdevelopment #xcode


Watch video Using didSet on Swift properties to clean up viewDidLoad online without registration, duration hours minute second in high quality. This video was added by user Peter Witham 12 September 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 86 once and liked it 4 people.