Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.46 KB

README.md

File metadata and controls

52 lines (34 loc) · 1.46 KB

SWUserDefaults

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

SWUserDefaults is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SWUserDefaults'

Usage

// 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")

Author

liuhongli, [email protected]

License

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