Latest 1.2.1
Homepage https://github.com/dclelland/Persistable
License MIT
Platforms ios 8.0, osx 10.10
Authors

Simple type safe persistable values to use as settings within your app.

Supports the type Any, which you should read as, "anything which is okay with being sent to UserDefaults.standard.set(forKey:)".


// Configuration
struct Settings {

    static var darkMode = Persistent(value: false, key: "darkMode")

    static var openCount = Persistent(value: 0, key: "openCount")

    static var volume = Persistent(value: 1.0, key: "volume") {
        didSet {
            print("Volume changed to (volume.value)")
        }
    }

}

// Setting
Settings.darkMode.value = true
Settings.openCount.value = Settings.openCount.value + 1
Settings.volume.resetValue()

// Getting
print(Settings.darkMode.value) // true
print(Settings.openCount.value) // 1

Latest podspec

{
    "name": "Persistable",
    "version": "1.2.1",
    "summary": "Simple type safe persistable values to use as settings within your app.",
    "homepage": "https://github.com/dclelland/Persistable",
    "license": {
        "type": "MIT"
    },
    "authors": {
        "Daniel Clelland": "[email protected]"
    },
    "source": {
        "git": "https://github.com/dclelland/Persistable.git",
        "tag": "1.2.1"
    },
    "swift_version": "4.2",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "ios": {
        "source_files": "Persistable.swift"
    },
    "osx": {
        "source_files": "Persistable.swift"
    }
}

Pin It on Pinterest

Share This