Lynda Course - Swift 5 Essential Thinking (Part 2)
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 ()...