Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LateInitialized Property Wrapper
@propertyWrapper
struct LateInitialized<T> {
var storage: T? = nil
var wrappedValue: T {
get {
guard let value = storage else {
fatalError("value has not been set!")
}
return value
}
set {
storage = newValue
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.