The more I get to know the Swift language, the more I like it. Any time the compiler finds my bugs before I ever run my app, that’s a good thing. And protecting me against my own mistakes is also a good thing.
Optionals is a thing in Swift that protects you against nil pointers. It’s a language feature that strongly encourages you to check your variables for validity before you run off and assume everything is fine. It’s also a very tricky par too the language to fully understand. Thank goodness for Xcode and all its helpful suggestions, but knowing what you are doing will guarantee you have clean code — not just code that compiles.
This is a good article on Optionals that I found easy to read and very helpful: