Nick Griffith

Nick Griffith
Posted by Nick Griffith
April 12, 2016

The Problem with Implicitly Unwrapped Optionals

Swift optionals, when used correctly, are a very powerful tool. When used incorrectly, they lead to one of the most common Swift crashes on Stack Overflow. When it comes to the correct usage of optionals, implicitly unwrapped optionals always get it wrong. There are two circumstances in Swift in which we deal with implicitly unwrapped optionals: @IBOutlets and interoperating with Objective-C code, which has not properly added nullability annotations. Outside of these two exceptions, we should avoid implicitly unwrapped optionals.

Read More