-
Notifications
You must be signed in to change notification settings - Fork 1
KeyStorage Read Options
#KeyStorage - Read Options
The below details the KeyStorage options available to read key values using one of the KeyStorage providers.
Unless otherwise stated each "get" method includes an option to set a default value if no saved value exists.
getString - Returns a string, if exists, for the provided key.
//Returns a string for the requested key. If no key is saved, nil is returned.
keyStoreProvider.getString(forKey: "Hello")
//Returns a string for the requested key. If no key is saved, the defaultValue is returned.
keyStoreProvider.getString(forKey: "Hello", defaultValue: "Default value if nothing is saved")getInt - Returns a Integer, if exists, for the provided key.
//Returns a Integer for the requested key. If no key is saved, 0 is returned.
keyStoreProvider.getInt(forKey: "Hello")
//Returns a Integer for the requested key. If no key is saved, the defaultValue is returned.
keyStoreProvider.getInt(forKey: "Hello", defaultValue: 42)getBool - Returns a Boolean, if exists, for the provided key.
//Returns a Boolean for the requested key. If no key is saved, false is returned.
keyStoreProvider.getBool(forKey: "Hello")
//Returns a Boolean for the requested key. If no key is saved, the defaultValue is returned.
keyStoreProvider.getBool(forKey: "Hello", defaultValue: true)getDate - Returns a Date, if exists, for the provided key.
//Returns a Date for the requested key. If no key is saved, nil is returned.
keyStoreProvider.getDate(forKey: "Hello")
//Returns a Date for the requested key. If no key is saved, the defaultValue is returned.
keyStoreProvider.getDate(forKey: "Hello", defaultValue: Date())getDouble - Returns a Double, if exists, for the provided key.
//Returns a Double for the requested key. If no key is saved, 0 is returned.
keyStoreProvider.getDouble(forKey: "Hello")
//Returns a Double for the requested key. If no key is saved, the defaultValue is returned.
keyStoreProvider.getDouble(forKey: "Hello", defaultValue: 42.01)getFloat - Returns a Float, if exists, for the provided key.
//Returns a Float for the requested key. If no key is saved, 0 is returned.
keyStoreProvider.getFloat(forKey: "Hello")
//Returns a Float for the requested key. If no key is saved, the defaultValue is returned.
keyStoreProvider.getFloat(forKey: "Hello", defaultValue: 42.01)getURL - Returns a URL, if exists, for the provided key.
//Returns a URL for the requested key. If no key is saved, nil is returned.
keyStoreProvider.getURL(forKey: "Hello")
//Returns a URL for the requested key. If no key is saved, the defaultValue is returned.
keyStoreProvider.getURL(forKey: "Hello", defaultValue: URL(string: "http://bencoding.com")!)getArray - Returns an NSArray, if exists, for the provided key.
//Returns an NSArray for the requested key. If no key is saved, nil is returned.
keyStoreProvider.getArray(forKey: "Hello")getDictionary - Returns an NSDictionary, if exists, for the provided key.
//Returns an NSDictionary for the requested key. If no key is saved, nil is returned.
keyStoreProvider.getDictionary(forKey: "Hello")