Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simplest way to implement a lazy stored property
class SomeClass {
lazy var storedProp = ""
}
let instance = SomeClass()
instance.storedProp // The property isn't initialized until this point
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment