Latest 1.3.0
Homepage https://github.com/1fr3dg/KeyValueData
License MIT
Platforms ios 11.0
Dependencies KeychainAccess, SQLite.swift
Authors

CI Status
Version
License
Platform

用来存储 Key-Value 型数据。可针对不同情况使用不同的后端存储。

Manage key-value data with same protocol, for kinds of backends.

Example

// Load/Create data

var _dataInKeyChain: KeyValueData = KeyValueDictionaryInKeychain(withKey: "account")

var _dataInUserDefaults: KeyValueData = KeyValueDictionaryInUserDefaults(withKey: "account")

// Data in => NSHomeDirectory()+"/Documents/(withKey).plist"
var _dataInPlist: KeyValueData = KeyValueDictionaryInDocumentsPlist(withKey: "account")

// Data in => NSHomeDirectory()+"/Documents/KeyValue.sqlite", table: withKey
var _dataInSQLite: KeyValueData = KeyValueDictionaryInSqlite(withKey: "account")

// Data in iCloud KV storage with key: withKey
var _dataIniCloud: KeyValueData = KeyValueDictionaryIniCloud(withKey: "account")

// set/get data from KV
_data["accountid"] = "12345678"
let id = _data["accountid"] as! String

// write data to disk
// this is not necessary for KeyChain/SQLite
_data.sync()

Requirements

  • iOS 11.0+

Installation

可通过CocoaPods安装:

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

pod "KeyValueData"

Author

Alfred Gao, [email protected]

License

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

Latest podspec

{
    "name": "KeyValueData",
    "version": "1.3.0",
    "summary": "Key-Value data store protocol.",
    "description": "This is designed to code with same protocol but store data to many places.nInclude .plist, KeyChain, UserDefault as well as Sqlite.",
    "homepage": "https://github.com/1fr3dg/KeyValueData",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Alfred Gao": "[email protected]"
    },
    "source": {
        "git": "https://github.com/1fr3dg/KeyValueData.git",
        "tag": "1.3.0"
    },
    "platforms": {
        "ios": "11.0"
    },
    "source_files": "KeyValueData/Classes/**/*",
    "dependencies": {
        "KeychainAccess": [
            "~> 3.0"
        ],
        "SQLite.swift": [
            "~> 0.11"
        ]
    }
}

Pin It on Pinterest

Share This