Posts

Showing posts with the label sets

Ray Wenderlich Fundamentals Course - Part 3

Yes! Finally some momentum. I'm basically going to continue with the Fundamentals. No more than 45 minutes to help out the old eyes! Start Time - 19:47 More Collections Dictionaries Mostly recap I reckon. Key-value pairs, unordered etc. Interesting - you can't have the same key! Didn't know that to be fair. Not going to put the whole dictionary in but some stuff you can do: for (name, pet) in namesAndPets {     print ( " \(name) has a pet called \(pet) " ) } let thorPet = namesAndPets [ "Thor" ] ?? "Nothing for thor" The second one of these is nil coalescing. It's a bit like ternary. These are pretty cool too: for (name, _ ) in namesAndPets {     print ( " \(name) has a pet!" ) } for pet in namesAndPets . values {     print (pet) } Challenge time! All good! One thing to check was adding a new item - needed to use the syntax NOT with update value.  Sets Have ...

Lynda Course - Swift 5 Essential Thinking (Part 2)

Image
A bit of time for some Swift before bed! Made some good progress last time - covered a lot of the basics and consolidated well. Let's go! Start Time - 20:37 3. Working With Collections Right, playground file open and ready to go! var levelDifficulty: [ String ] = [] var otherArray: Array < String > = [] I tend to use the first way (if empty array).  Various use of .count, .isEmpty etc.  An out of range exception error happens when trying something in the array that doesn't exist.  Core Array Methods Nice recap! // Changing & appending items var characterTypes = [ "Dwarf" , "Elf" , "Goblin" , "Ranger" ] characterTypes . append ( "Orc" ) //Inserting and removing items characterTypes . insert ( "Wizard" , at: 5 ) characterTypes . remove (at: 4 ) // Ordering and querying values var reversedCharacters = characterTypes . reversed () characterTypes . sort ()...

Stephen DeStefano Swift 5 Course - Part 8 (Lectures 32 to 38)

Image
Yes, two in a day! As mentioned earlier, I want to crack on and get the technical stuff DONE! Just want to get on to the projects. So the plan is to get at least collections done, then hopefully enumerations (maybe error handling too!) Start Time - 20:08 Arrays Again, as with other stuff in this course, I know this well so more of a skim through. A couple of cool things. The default value part is the same item repeated basically. The adding two arrays together means a bigger list basically. Can use the isEmpty property. Then use that within an if statement. Other stuff insert at, append, remove all etc. So using the range ... to put in several values at once. Iterating over the array. Use of the if let to see if an item is in the array. Use of sorted function. Then 'by'; you can use the < or >. Or others probably! Quiz - 10 out of 10 and one of the easiest so far! Dictionaries The syntax and concept of these is absolutely fine. Key-value pairs...

Bob Lee Course Part 9 (Consolidation of chapter 1 - lectures 1 to 15!)

Image
Yes, it's time for some consolidation baby! I could just do so for the past few lectures but it makes more sense to go through chapter one in its entirety. If anything does seem really familiar, that's fine - I will obviously spend less time on that! OK, here we go! Start Time - 17:35 Lecture 1 - Course Overview (skipped!) Lecture 2 - Introduction Key tip to takeaway from this summary is NOT just to click on the 'fix errors' when the 'red' errors come up. They can lead to more errors and mess up the code - then be impossible to track back and sort out! Lecture 3 - Optionals So the big question here is WHY use optionals in the first place. Something to remember here is that Swift is the only language (well, one of the very few at least) that uses optionals. They are a great feature! *Right, rather than play the videos again, I am actually going to use Bob's lecture notes from here: https://www.bobthedeveloper.io/course/swift/1000-swift-fundame...