swift 3 – swift optionals

the best way to take care of the optionals mark variable in the swift,

var lotSelected: Int?

if let lot = lotSelected {

always use “if let” sentence to check then use the new constant.


Lazy instantiation

We put the instance variable initialize routine to getter not constructor,

that’s pretty common in iOS, called “Lazy instantiation”

waiting until the last second to instantiate something that you really need


just like following example.