Inside iOS Dev

Optionals Are Evil..?

10.28.2019 - By Alex Bush, Sandeep AggarwalPlay

Download our free app to listen on your phone

Download on the App StoreGet it on Google Play

When and where should optionals be used? What are the advantages and disadvantages of optionals? Before Swift, iOS developers wrote their apps using Objective-C. In Objective-C, programmers could send messages to nil without the program crashing and in some cases was considered a feature. However, sometimes objects were unexpectedly nil and the program would incorrectly execute. Today, Swift uses optionals to more explicitly handle the case when an object is nil.

More episodes from Inside iOS Dev