Add integer methods

This commit is contained in:
ismailgulek
2020-09-28 16:17:13 +03:00
parent d6c3b6f95d
commit 442868f46a
3 changed files with 23 additions and 0 deletions
@@ -49,6 +49,10 @@ extension MemoryStore: KeyValueStore {
setObject(value, forKey: key)
}
func set(_ value: Int?, forKey key: KeyValueStoreKey) throws {
setObject(value, forKey: key)
}
// getters
func data(forKey key: KeyValueStoreKey) throws -> Data? {
return object(forKey: key) as? Data
@@ -62,6 +66,10 @@ extension MemoryStore: KeyValueStore {
return object(forKey: key) as? Bool
}
func integer(forKey key: KeyValueStoreKey) throws -> Int? {
return object(forKey: key) as? Int
}
// remove
func removeObject(forKey key: KeyValueStoreKey) {
map.removeValue(forKey: key)