Posts

Showing posts with the label two phase initialization

Bob Lee Course Part 15 (Consolidation of Chapter 2 - lectures 16 to 25)

So, a great chance to make sense of all of the concepts in Chapter 2. I will then crack on with Chapter 3 tomorrow! Chapter 2 was all about Object Oriented Swift. A lot of the terminology was familiar but I do feel on the most part (other than singleton stuff...) that my understanding improved with all of this. So let's go over it now! Start Time - 12:03 Convenience Init My Take - this is very simply another way to initialize an object. It's called convenience because the block of code for that init method has it all going on, then the initialisation process is very simple, or convenient. It could be as simple as using () after the class name. Yep, got it! Here's my example from before: class  Human {      var  name:  String      init (name:  String ) {          self . name  = name     }           convenience   init () {     ...

Bob Lee Course Part 13 (lectures 21 to 23)

Image
Back to Bob! I have genuinely missed learning new information, having spent a few days doing my mega consolidation project! The will be updated at the end of each 'stage' or mini stage. So my aim now is to complete the rest of this chapter, then I will do a consolidation review of the entire chapter - object oriented Swift. OK, let's get stuck in! Start Time - 17:02 Override Method, Init, Property SO this is what we will be looking at - the super.viewDidLoad bit... I get the idea of the override method. If you have a function with a class, then in the subclass, you want to change how the method works. So you need to use the override keyword. Bob makes the point that if you use the original value of what is returned, then you need to use the super keyword... Xcode doing an update so am screenshotting rather than typing out actual code. All the above is fine - I had forgotten that I still need to use the super bit - even if the value is not...