Skip to content

Commit

Permalink
Fixes a bug where overriding a UserDefaults key would not fall back t…
Browse files Browse the repository at this point in the history
…o the default/previous implementation when the value for a different key is requested (#187)
  • Loading branch information
Myrronth committed Sep 1, 2023
1 parent 8d79378 commit 4628db5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/UserDefaultsClient/TestKey.swift
Expand Up @@ -32,18 +32,18 @@ extension UserDefaultsClient {
)

public mutating func override(bool: Bool, forKey key: String) {
self.boolForKey = { [self] in $0 == key ? bool : self.boolForKey(key) }
self.boolForKey = { [self] in $0 == key ? bool : self.boolForKey($0) }
}

public mutating func override(data: Data, forKey key: String) {
self.dataForKey = { [self] in $0 == key ? data : self.dataForKey(key) }
self.dataForKey = { [self] in $0 == key ? data : self.dataForKey($0) }
}

public mutating func override(double: Double, forKey key: String) {
self.doubleForKey = { [self] in $0 == key ? double : self.doubleForKey(key) }
self.doubleForKey = { [self] in $0 == key ? double : self.doubleForKey($0) }
}

public mutating func override(integer: Int, forKey key: String) {
self.integerForKey = { [self] in $0 == key ? integer : self.integerForKey(key) }
self.integerForKey = { [self] in $0 == key ? integer : self.integerForKey($0) }
}
}

0 comments on commit 4628db5

Please sign in to comment.