Why create “Implicitly Unwrapped Optionals”, since that implies you know there’s a value?

Before I can describe the use cases for Implicitly Unwrapped Optionals, you should already understand what Optionals and Implicitly Unwrapped Optionals are in Swift. If you do not, I recommend you first read my article on optionals When To Use An Implicitly Unwrapped Optional There are two main reasons that one would create an Implicitly … Read more

What is an optional value in Swift?

An optional in Swift is a type that can hold either a value or no value. Optionals are written by appending a ? to any type: var name: String? = “Bertie” Optionals (along with Generics) are one of the most difficult Swift concepts to understand. Because of how they are written and used, it’s easy … Read more

Uses for Optional

The main design goal of Optional is to provide a means for a function returning a value to indicate the absence of a return value. See this discussion. This allows the caller to continue a chain of fluent method calls. This most closely matches use case #1 in the OP’s question. Although, absence of a … Read more