Optionals are one of the important data types in Swift programming. In Objective-C, which is said to be the parent language of Swift, the concept of Optionals does not exist.

Before going deep into comparisons and programmatic discussions about the Optional type, let’s get to the definition and basic details of it.

What are Optionals? Where are they used in a Swift Program?

Optionals are data types in Swift which are just like Int, String etc… They are used in places where nil value could possibly occur. According to Objective-C language, nil is used as a pointer to indicate an object that has been removed or doesn't exist anymore. …

Gayathri Veeraraghavan

Happy vibed, light-hearted woman who is crazy enough to try and learn anything in the world!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store