swift optionals code example
Example 1: declaring optionals swift
var myOptional: Any? // any can be replaced with whatever type you need
Example 2: swift declare optional values
// 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