Fundamentals of Swift Collections While preparing for a technical coding interview, and practising LeetCode questions, I created this cheatsheet . As you know, coding interview requires interviewee to manipulate collection types (array, dictionary, set) expertly to solve mathematic puzzles. Loop array for value in array for index in array . indices for ( index , value ) in array . enumerated () Loop array with range for i in 0 ..< array . count // Traditional loop with indices for v in array [ 2 ... ] // Skip the first 2 elements for v in array [ ..< ( array . count - 2 )] // Skip the last 2 elements for v in array . prefix ( 3 ) // The first 3 for v in array . suffix ( 3 ) // The last 3 Loop dictionary for ( key , value ) in dictionary Check if dictionary has key dictionary . keys . contains ( "k" ) // Alternative, if the value type is _never_ `Optional` if dictionary [ "k" ] == nil // "k" is no...