Latest 0.4.2
License MIT
Platforms ios 9.0, requires ARC
Dependencies SQLite.swift


CocoaPods Version Platform Carthage compatible License MIT

objc version :


  • iOS 9.0+
  • Xcode 8.0
  • Swift 3.0


import 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


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"


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


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



Update Cartfile to include the following:

github "sgxiang/YTKKeyValueStore_Swift" ~> 0.4.2

Run carthage update and add the appropriate framework.


Update Podfile to include the following:


pod 'YTKKeyValueStore_Swift', '~> 0.4.2'

Run pod install

Embedded Framework

  • Add YTKKeyValueStore as a submodule by opening the Terminal, cd-ing into your top-level project directory, and entering the following command:
$ git submodule add
  • Open the YTKKeyValueStore folder, and drag YTKKeyValueStore.xcodeproj into the file navigator of your app project.

  • In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.

  • Ensure that the deployment target of YTKKeyValueStore.framework matches that of the application target.

  • In the tab bar at the top of that window, open the "Build Phases" panel.
    Expand the "Target Dependencies" group, and add YTKKeyValueStore.framework.

  • Click on the + button at the top left of the panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and add YTKKeyValueStore.framework.



Latest podspec

    "name": "YTKKeyValueStore_Swift",
    "version": "0.4.2",
    "summary": "A simple Key-Value storage tool, using Sqlite as backend.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "sgxiang": "[email protected]"
    "platforms": {
        "ios": "9.0"
    "source": {
        "git": "",
        "tag": "0.4.2"
    "source_files": "YTKKeyValueStore/*.swift",
    "requires_arc": true,
    "module_name": "YTKKeyValueStore",
    "dependencies": {
        "SQLite.swift": [
            "~> 0.11.3"
    "pushed_with_swift_version": "3.0"

Pin It on Pinterest

Share This