Optionals are a special feature in Swift used to indicate that an instance may not have a value. When you see an optional, you know that one of two things is true about that instance: It either has a value and it is ready for use, or it has no value. If an instance has no value associated with it, we say that it is nil.
You can use optionals with any type to signal that an instance is potentially
This feature distinguishes Swift from Objective-C, which only allows objects to be
This chapter covers how to declare optional types, how to use optional binding to check whether an optional is
nil and make use of its value if it has one, and how to use optional chaining to query a sequence of optional values. ...