(ios) Bug fix: getCodable & setCodable were assuming standard UserDefaults, instead of simply using self.
@@ -4,7 +4,7 @@ import PhoenixShared
extension UserDefaults {
func getCodable<Element: Codable>(forKey key: String) -> Element? {
- guard let data = UserDefaults.standard.data(forKey: key) else {
+ guard let data = self.data(forKey: key) else {
return nil
}
let element = try? JSONDecoder().decode(Element.self, from: data)
@@ -13,7 +13,7 @@ extension UserDefaults {
func setCodable<Element: Codable>(value: Element, forKey key: String) {
let data = try? JSONEncoder().encode(value)
- UserDefaults.standard.setValue(data, forKey: key)
+ self.setValue(data, forKey: key)
}
}
