UserDefault
@propertyWrapper
public struct UserDefault<Value>
-
Declaration
Swift
public var defaultValue: Value
-
Declaration
Swift
public var storage: UserDefaults
-
Declaration
Swift
public init(_ key: String, defaultValue: Value, storage: UserDefaults = .standard)
-
Declaration
Swift
public init<Key: RawRepresentable>( _ key: Key, defaultValue: Value, storage: UserDefaults = .standard ) where Key.RawValue == String
-
Declaration
Swift
public var wrappedValue: Value { get set }
-
Creates a UserDefaults wrapper with a default value of
false
Declaration
Swift
public init(_ key: String)
Parameters
key
key of stored value
-
Convenience initalizer for nil-able values.
Using this initializer it is not necessary to set a
defaultValue
ofnil
.Declaration
Swift
public init(_ key: String)
Parameters
key
Key for locating value in storage
-
Convenience initalizer for nil-able values.
Using this initializer it is not necessary to set a
defaultValue
ofnil
.Declaration
Swift
public init<Key>(_ key: Key) where Key : RawRepresentable, Key.RawValue == String
Parameters
key
Key for locating value in storage