Posts

Showing posts with the label Harrison Ferone

Lynda Course - Swift 5 Essential Thinking (Part 8 - FINAL!)

Image
Here we go! The last part - the challenge - of Harrison's course. After this I will review all of the course and focus on what needs practising as several bits have come up that I definitely need to go over. Then I'll look at the next course/plan! Start Time - 13:48 Let's break this down first. 1 is easy. 2 is all good. 3 is harder but I think I remember the syntax. 4 is, again, tricky but I can do it. Similar with 5 to 7 - error stuff which I may need help with! Right enough deliberation let's give it a go - without any help first! Right, so these bits I'm OK with - // 1 enum ActionError: Error {     case InsufficientMP, OutOfRange, UnknownError } // 2 // 3 func attackEnemy(mp: Int , distance: Double )  throws -> Bool ? {          // 4     guard mp < 10 else {         throw ActionError . InsufficientMP     }     // 5     guard d...

Lynda Course - Swift 5 Essential Thinking (Part 7)

Last part of the course! I'm going spend around half an hour now on this and the rest tomorrow, if/when needed. Let's do this! Start time - 21:00 Enumerations All of the declaring and creating no problems. I want to see the use of assigning values etc. That bit I'm not so sure about. // Declaring an enum enum GameState {     case Completed, Initialzing, LoadingData } // Storing and switching on an enum value var currentState = GameState . Completed switch currentState {      case . Completed :     print ( "All tasks complete" ) case . Initialzing :     print ( "Init in process" ) case . LoadingData :     print ( "Data is loading" ) } Raw and Associated Values You can do this -  enum NonPlayableCharacters: String {     case Villager     case Blacksmith     case Trader } But no other info - quite limited. Can be access...

Lynda Course - Swift 5 Essential Thinking (Part 6)

Image
Here we go! A quick session now. Not sure how long I've got but gonna do a bit. A couple more chapters of this course, then will review what else from Lynda is worth looking at. At some point I need to decide if the subscription is worth it.  Start Time - 12:57 6. Classes, Structs and Beyond So I looked at the initial couple of videos last time about value vs reference types. Now the focus is specifically on classes. Classes All this is fine - just a recap - class Adventurer {          var name: String     var maxHealth: Int               var specialMove: String ?          init (name: String , maxHP: Int ) {         self . name = name         self . maxHealth = maxHP     }          convenience init (name: String ) {         self . init (name: ...