Check out example codes for "declaring optionals swift". It will help you in understanding the concepts better.

Code Example 1

var myOptional: Any? // any can be replaced with whatever type you need

Code Example 2

// Optional values are types that can contain nil
var optionalValue: String? // this can be done with more than strings, but for this example that's what was used

Learn ReactJs, React Native from akashmittal.com