To run the example project, clone the repo, and run pod install
from the Example directory first.
SWUserDefaults is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SWUserDefaults'
// save Int value to UserDefaults
SWUserDefaults.save(3, "key1")
// get Int value from UserDefaults
let value = SWUserDefaults.get("key1", Int.self)
// delete from UserDefaults
SWUserDefaults.delete("key1")
// save dict value to UserDefaults
let dict: [String : Any] = ["name": "Lily", "age": 18]
SWUserDefaults.save(dict, "key2")
// get dict value from UserDefaults
let dictValue = SWUserDefaults.get("key2", [String : Any].self)
// delete from UserDefaults
SWUserDefaults.delete("key2")
liuhongli, [email protected]
SWUserDefaults is available under the MIT license. See the LICENSE file for more info.