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
@@ -19,7 +19,16 @@ import Foundation
typealias KeyValueStoreKey = String
protocol KeyValueStore {
func set(_ value: Any?, forKey key: KeyValueStoreKey) throws
func object(forKey key: KeyValueStoreKey) throws -> Any?
// setters
func setData(_ value: Data?, forKey key: KeyValueStoreKey) throws
func setString(_ value: String?, forKey key: KeyValueStoreKey) throws
func setBool(_ value: Bool?, forKey key: KeyValueStoreKey) throws
// getters
func data(forKey key: KeyValueStoreKey) throws -> Data?
func string(forKey key: KeyValueStoreKey) throws -> String?
func bool(forKey key: KeyValueStoreKey) throws -> Bool?
// remove
func removeObject(forKey key: KeyValueStoreKey) throws
}