Latest 0.2.0
Homepage https://github.com/beeth0ven/DiskVar
License MIT
Platforms ios 8.0, requires ARC
Authors

Provide a convenience method to access NSUserDefaults

Usage:

 class ViewController: UIViewController {

    private var history = DiskVar<[String]>(key: "ViewController.history", defaultValue: ["cat"])

    override func viewDidLoad() {
        super.viewDidLoad()

        // get
        print(history.value)        // ["cat"]

        // set
        history.value.append("dog") // ["cat", "dog"]

    }

 }

ViewController’s Property "history" is a Array of String which has a defaultValue of ["cat"].
"ViewController.history" is the key used in NSUserDefaults which should be unique in the project.
And the history’s value will not be lost even if the app is closed.

Installation

For iOS 8+ projects with CocoaPods:


   pod 'DiskVar', '~> 0.2'

License

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

Latest podspec

{
    "name": "DiskVar",
    "platforms": {
        "ios": "8.0"
    },
    "summary": "Provide a convenience method to access NSUserDefaults",
    "requires_arc": true,
    "version": "0.2.0",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Luo Jie": "[email protected]"
    },
    "homepage": "https://github.com/beeth0ven/DiskVar",
    "source": {
        "git": "https://github.com/beeth0ven/DiskVar.git",
        "tag": "0.2.0"
    },
    "source_files": "DiskVar/**/*.{swift}"
}

Pin It on Pinterest

Share This