UserDefault

@propertyWrapper
public struct UserDefault<Value>

Available where Value == Bool

  • Creates a UserDefaults wrapper with a default value of false

    Declaration

    Swift

    public init(_ key: String)

    Parameters

    key

    key of stored value

Available where Value: ExpressibleByNilLiteral

  • Convenience initalizer for nil-able values.

    Using this initializer it is not necessary to set a defaultValue of nil.

    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 of nil.

    Declaration

    Swift

    public init<Key>(_ key: Key) where Key : RawRepresentable, Key.RawValue == String

    Parameters

    key

    Key for locating value in storage