Posts

Showing posts with the label inits

Ray Wenderlich Course Part 12 (up to lesson 110)

Here we go - the last of the 'theoretical' Ray sections of lessons before the next project. I'm not expecting to get all of this, after how tricky the last couple of sections have been. Again, I will type along where I can and keep it at normal speed.  Classes vs Structures So here is a simple structure (already typed out for me): struct PersonStruct {   var firstName: String   var lastName: String   var fullName: String {     return " \ ( firstName ) \ ( lastName )"   } } To make a class, it is simple enough. Same as above.  class P ersonClass {     var firstName: String     var lastName: String          var fullName: String {         return " \ ( firstName ) \ ( lastName )"     } } The difference of course is that inits are needed. I know all about this from before.  Ray mentions Heap vs Stack vi...

Angela Yu Course Part 13 (up to lesson 133)

Image
I'm back! And so is Angela! Well, the last bit of her epic course is - this time 'Intermediate Swift'. I was going to leave it after Auto Layout but actually felt this would be well worth exploring and completing. THEN it will be time for another Udemy course! Here we go! Classes and Objects The first bit of this is recap - a class containing blueprints e.g. properties and behaviours. The object is an instance of the class. So first up, I've created a new project under MacOS that is a 'command line' file. Something interesting - you cannot call instances/values a keyword e.g. var class would be too confusing! Putting back ticks around it is allowed though it should be discouraged! All of the rest is recap to be honest. Enums This is basically creating a new data type. In our example we're working on, it is a 'car' data type. enum CarMake {          case Ferrari     case Mercedes     case BMW     case...