Change KeyValueStore api

This commit is contained in:
ismailgulek
2020-07-28 18:21:39 +03:00
parent 3937f706aa
commit 8bd8e99f72
4 changed files with 90 additions and 31 deletions

View File

@@ -73,14 +73,14 @@ final class PinCodePreferences: NSObject {
var pin: String? {
get {
do {
return try store.object(forKey: StoreKeys.pin) as? String
return try store.string(forKey: StoreKeys.pin)
} catch let error {
NSLog("[PinCodePreferences] Error when reading user pin from store: \(error)")
return nil
}
} set {
do {
try store.set(newValue, forKey: StoreKeys.pin)
try store.setString(newValue, forKey: StoreKeys.pin)
} catch let error {
NSLog("[PinCodePreferences] Error when storing user pin to the store: \(error)")
}
@@ -90,14 +90,14 @@ final class PinCodePreferences: NSObject {
var biometricsEnabled: Bool? {
get {
do {
return try store.object(forKey: StoreKeys.biometricsEnabled) as? Bool
return try store.bool(forKey: StoreKeys.biometricsEnabled)
} catch let error {
NSLog("[PinCodePreferences] Error when reading biometrics enabled from store: \(error)")
return nil
}
} set {
do {
try store.set(newValue, forKey: StoreKeys.biometricsEnabled)
try store.setBool(newValue, forKey: StoreKeys.biometricsEnabled)
} catch let error {
NSLog("[PinCodePreferences] Error when storing biometrics enabled to the store: \(error)")
}