Fixed the initialiser of the KeychainStorage property wrapper.

This commit is contained in:
Javier Cicchelli 2022-12-11 22:11:28 +01:00
parent c9468a6a68
commit 07defd0045

View File

@ -62,10 +62,8 @@ 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
}
@ -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.")
}
}