Chapter 10. Using Optional Types

When I first started using Swift, the concept that I had the most trouble with was optional types. Coming from an Objective-C, C, Java, and Python background, I was able to relate to most of Swift's features to how things worked in one of the other languages that I knew, but optionals were different. There really was nothing like optionals in the other languages that I used, so it took a lot of reading to fully understand them. While I briefly covered optionals in Chapter 2, Learning about Variables, Constants, Strings, and Operators, which gave enough of an overview to get started with, we need to cover a lot more information to really understand what optionals are, how to properly use them, and why they are so ...

Get Swift: Developing iOS Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.