Posts

Showing posts with the label options chaining

Bob Lee Course Part 2 (lessons 4 to 5)

Image
Moving on with Bob's course. Like I said, I enjoyed the last part as it did help to explain optionals - even though he was waffly and not always clear. Still, going to crack on with the next one. Start Time - 19:28 Optional Chaining *This time I'm going to create an Xcode playground to code along with the lesson. let labelColor = UILabel (). highlightedTextColor ?. cgColor So this is an example of an optional in action.  *I can just copy this from the course website - save some time! class Human {     var name: String     init (name: String ) {         self . name = name     }          func sayHello() {         print ( "Hello, I'm \ ( name )" )     } } class Apartment {     var human : Human ? = nil   } What we're showing in the Apartment class is that the human value is of the Human class but ...