A simple wrapper for NSUserDefaults
- Device defaults: defaults that won't change based on the signed in user
- User defaults: defaults that depend on the signed in user
Set a device default
SimpleDefaults.sharedInstance.setDeviceDefaultValue(value: [1,2,3,4,5], key: "my_key")
Retrieve the device default you just set
// This would return [1,2,3,4,5]
SimpleDefaults.sharedInstance.getDeviceDefault(key: "my_default_key", fallbackValue: [])
Value is typechecked against the type of fallbackValue If they aren't the same type, returns fallbackValue even if the default exists
// This would return 5
SimpleDefaults.sharedInstance.getDeviceDefault(key: "my_default_key", fallbackValue: 5)
- Brian Kracoff
- [email protected]
- http://www.kracoff.org
Literally is available under the MIT license. See the LICENSE file for more info.