Posts

Showing posts with the label get

Bob Lee Course Part 10 (lectures 16 to 18)

Such a busy week - first chance I've had to code for a while! Last time, it was REALLY useful to consolidate and go through what I had done previously. Now I am ready for the next chapter: Object Oriented Programming! Let's go! Start Time - 16:57 Convenience Init I know that these are used with classes but can't remember the purpose of the 'convenience' init. Is this just an alternative way of initializing? Not sure! So this is to do with initializing quickly. Lazy keyword? class Human {     var name: String     init (name: String ) {         self . name = name     } } let larry = Human (name: "Larry" ) let jeff = Human () In the above, an error comes up as I have not initialized the jeff object.  Here we go! class Human {     var name: String     init (name: String ) {         self . name = name     }    ...