I am using the set() function in a template like this:
@propertyWrapper
struct UserDefault<T> {
let key: String
let defaultValue: T
//let defaults = KeychainWrapper.standard // this gives compiler error "No exact matches in call to instance 'set'"
let defaults = UserDefaults.standard // this works OK
init(_ key: String, defaultValue: T) {
self.key = key
self.defaultValue = defaultValue
}
var wrappedValue: T {
get {
return defaults.object(forKey: key) as? T ?? defaultValue
}
set {
defaults.set(newValue as T , forKey: key)
}
}
}
When using UserDefaults the code compiles, when using KeychainWrapper it does not. Could you please have a look into that issues ?! Thanks and regards
Hi,
I am using the set() function in a template like this:
When using UserDefaults the code compiles, when using KeychainWrapper it does not. Could you please have a look into that issues ?! Thanks and regards
Christian