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
|
self.keychain = keychain
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let data = try keychain.getData(key, ignoringAttributeSynchronizable: true)
|
guard let data = try keychain.getData(key, ignoringAttributeSynchronizable: true) else {
|
||||||
|
self._value = .init(initialValue: defaultValue)
|
||||||
guard let data else {
|
|
||||||
assertionFailure("The data of the '\(key)' key should have been obtained from the keychain storage.")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let model = try decoder.decode(Value.self, from: data)
|
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.")
|
assertionFailure("The data for the '\(key)' key should have been decoded properly.")
|
||||||
}
|
}
|
||||||
} catch {
|
} 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