What are lazy stored properties in Swift ?

Lazy stored property is a property whose initial value is not calculated until the first time it is used. You indicate a lazy stored property by writing a lazy modifier before its name. We use lazy stored property when the value of the property depends upon external source or it requires complex computational steps to calculate the initial value of the property.

lazy var dataID = dateIdentifier()

Leave a Reply