TestsTested | ✓ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Aug 2015 |
SPMSupports SPM | ✗ |
Maintained by Roman Klauke.
Import the framework in your file using import ROKKeyValue
to work with ROKKeyValue.
Each method allows you to provide an alternative Realm in which the keys should be saved.
ROKKeyValue.put("test", bool: false)
ROKKeyValue.put("date", date: NSDate())
ROKKeyValue.put("double", double: 1.5)
ROKKeyValue.put("float", float: 9.12)
ROKKeyValue.put("int", int: 1)
ROKKeyValue.put("string", string: "My String Key")
If one of those keys already exists, ROKKeyValue will simply update the existing key with the new value.
ROKKeyValue.getDouble("Double")
ROKKeyValue.getDouble("Double", defaultValue: 1.1)
ROKKeyValue.getFloat("Float")
ROKKeyValue.getFloat("Float", defaultValue: 1.1)
ROKKeyValue.getInt("Int")
ROKKeyValue.getInt("Int", defaultValue: 1)
ROKKeyValue.getBool("Bool")
ROKKeyValue.getBool("Bool", defaultValue: false)
ROKKeyValue.getDate("Date")
ROKKeyValue.getDate("keDatey", defaultValue: NSDate())
ROKKeyValue.getString("String")
ROKKeyValue.getString("String", defaultValue: "")
Using ROKKeyValue.getBool("Bool", defaultValue: false)
will return the specified defaultValue
if the value does not exist. Calling ROKKeyValue.getBool("Bool")
would return the corredsponding zero or empty value for the chosen data type.
ROKKeyValue.remove("key")
Get the total number of keys in the given realm:
ROKKeyValue.entryCount()
Get the “raw” key as an Object
:
ROKKeyValue.getRaw("test")
ROKKeyValue depends on Realm
and iOS 8.0. It’s currently only available for Swift 1.2. A Swift 2.0 branch is planed.
ROKKeyValue is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ROKKeyValue"
Roman Klauke, [email protected]
ROKKeyValue is available under the MIT license. See the LICENSE file for more info.