Skip to content

Instance Method

get(_:default:)

Gets a value from the Extend storage falling back to the default value if it does not exist or cannot be casted to T.
func get<T>(_ key: AnyKeyPath, default d: T) -> T

Discussion

KeyPath-based alternative to get(_:default:).

let foo: Foo = extend.get(\MyType.Foo, default: defaultFoo)