Optionals Toolbox Essentials

Optionals are the keystone in the Swift Cathedral of Safety. They protect against the possibility of a value being absent, the program looking for that value and then crashing. Welcome to a guide through 6 useful tools used to navigate the landscape of question marks, exclamations marks (and even double question marks??)! When a value is optional it means that it can be in one of two states: 1) it contains something or 2) it contains nil. In fact optionals in Swift are enums with two cases: .None, or .Some<t>. Optionals are a distinct type and the compiler wont let them be used until the value has been “unwrapped”.