UserDefaultsWrapper
@propertyWrapper
public struct UserDefaultsWrapper<T> where T : HandyJSON
UserDefaults Wrapper
使用
// HandyJSON Type
class Person: HandyJSON {
var name = ""
required init() {}
}
@UserDefaultsWrapper(key: .handyJSON("person"))
var person = Person()
// Base Type
@UserDefaultsWrapper(key: .base("username"))
var username = "username"
-
Declaration
Swift
public init(wrappedValue: T, key: UserDefaultsWrapperKey)
-
Declaration
Swift
public var wrappedValue: T { get set }