Home

Awesome

YTKKeyValueStore

CocoaPods Version Platform Carthage compatible License MIT

objc version :https://github.com/yuantiku/YTKKeyValueStore

Requirements

Usage

import YTKKeyValueStore

YTKKeyValueStore

var store = try! YTKKeyValueStore("dbtest.sqlite3")   // create or open the key-value store

try! store.createTable(tableName: "User")    // create table

let table = store["User"]      // get table (YTKTable)

try! store.dropTable("User")    // drop table

YTKTable

let isExists = table.isExists

try! table.put( "name" <- "sgxiang")     // put value("sgxiang") for key("name") into table , support string,number,dictionary,array


let objct = try! table.get("name")    // get object with key , return YTKObject?
let item = try! table.getItem("name")   // get item with key ,return YTKItem?
let allItems = try! table.getAllItems()  // get all item with key , return  [YTKItem]?


try! table.clear()  // clear table
try! table.delete("name1","name2")   // delete row where key == "name1" and "name2"
try! table.deletePreLike("name")   // delete row where key pre like "name"

YTKItem

itemId       :   itemKey
itemObject   :   itemValue , is json string
createdTime  :   item created time

YTKObject

objectValue       :     return  AnyObject?
stringValue       :     return  String?
numberValue       :     return  NSNumber?
dictionaryValue   :     return  Dictionary<String , AnyObject>?
arrayValue        :     return  Array<AnyObject>?

Installation

Carthage

Update Cartfile to include the following:

github "sgxiang/YTKKeyValueStore_Swift" ~> 0.4.2

Run carthage update and add the appropriate framework.

CocoaPods

Update Podfile to include the following:

use_frameworks!

pod 'YTKKeyValueStore_Swift', '~> 0.4.2'

Run pod install

Embedded Framework

$ git submodule add https://github.com/Sgxiang/YTKKeyValueStore_Swift.git

Communication

Author