Treehouse Intermediate Course Part 3 (Initialization)
Well here we go - next part of Pasan's course! Not going to waste time with a preamble but am honestly going to aim for 40 minutes max. It's 11:40 am (Dubai time) now so will finish at 12:20 - or as close to if I'm in the middle of something. Object Initialization So what is init? Preparing the instance of a class/struct/enum by giving values to stored properties. Parameters are used - following the same rules as function parameters. Default or optional values can be used to store properties. All stored properties must have initial values. Structs have member-wise initializers. Failable and Throwing Initializers What about where init is not possible? It could depend on external data. *All coding typed out by Pasan already - I'm just copying and pasting it. enum Day: Int { case sunday = 1 case monday case tuesday case wednesday case thursday case friday ...