Fixed the initialiser of the KeychainStorage property wrapper.
This commit is contained in:
parent
c9468a6a68
commit
07defd0045
@ -62,13 +62,11 @@ public struct KeychainStorage<Model: Codable>: DynamicProperty {
|
||||
self.keychain = keychain
|
||||
|
||||
do {
|
||||
let data = try keychain.getData(key, ignoringAttributeSynchronizable: true)
|
||||
|
||||
guard let data else {
|
||||
assertionFailure("The data of the '\(key)' key should have been obtained from the keychain storage.")
|
||||
guard let data = try keychain.getData(key, ignoringAttributeSynchronizable: true) else {
|
||||
self._value = .init(initialValue: defaultValue)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
let model = try decoder.decode(Value.self, from: data)
|
||||
|
||||
@ -77,7 +75,7 @@ public struct KeychainStorage<Model: Codable>: DynamicProperty {
|
||||
assertionFailure("The data for the '\(key)' key should have been decoded properly.")
|
||||
}
|
||||
} catch {
|
||||
self._value = .init(initialValue: defaultValue)
|
||||
assertionFailure("The data of the '\(key)' key should have been obtained from the keychain storage.")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user