StoredValue

@propertyWrapper
public struct StoredValue<Value>

UserDefault存储属性包装器注解,兼容AnyArchivable协议,默认为手工指定或初始值

使用示例: @StoredValue(“userName”) static var userName: String = “”

  • Undocumented

    Declaration

    Swift

    public init(
        wrappedValue: Value,
        _ key: String,
        defaultValue: Value? = nil
    )
  • Undocumented

    Declaration

    Swift

    public init<WrappedValue>(
        wrappedValue: WrappedValue? = nil,
        _ key: String,
        defaultValue: Value? = nil
    ) where WrappedValue? == Value
  • Undocumented

    Declaration

    Swift

    public var wrappedValue: Value { get set }