What is the lazy property in swift? [closed]

variables

As lazy properties are only calculated once called it means it will also use the state of the moment it’s getting called. For example, if the collection of people is mutable it could mean that oldest is different when called before a mutating takes plac
e:

Lazy variables allow you to delay the initialisation of stored properties. This can be useful to only perform expensive work when it’s actually needed. The different between lazy- and computed properties is important in cases you need to have calculations based on the current state of values.

Leave a Comment