Skip to content

briankracoff/SimpleDefaults

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SimpleDefaults

A simple wrapper for NSUserDefaults

Types of defaults

  • Device defaults: defaults that won't change based on the signed in user
  • User defaults: defaults that depend on the signed in user

Usage

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)

Contact

License

Literally is available under the MIT license. See the LICENSE file for more info.

About

A simple wrapper for NSUserDefaults

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages