Swiftpack.co -  apparata/SQLiteKit as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Simple Swift wrapper for accessing a SQLite database in a thread safe manner.
.package(url: "https://github.com/apparata/SQLiteKit.git", from: "0.3.0")


SwiftPM compatible MIT License language Swift 5.1 platform macOS platform Linux

Simple Swift wrapper for accessing a .sqlite3 database in a thread safe manner.


SQLiteKit is released under the MIT license. See LICENSE file for more detailed information.

Table of Contents

Getting Started

Add SQLiteKit to your Swift package by adding the following to your Package.swift file in the dependencies array:

.package(url: "https://github.com/apparata/SQLiteKit.git", from: "<version>")

If you are using Xcode 11 or newer, you can add SQLiteKit by entering the URL to the repository via the File menu:

File > Swift Packages > Add Package Dependency...

Note: SQLiteKit requires Swift 5.1 or later.

Reference Documentation

There is generated reference documentation available.


import Foundation
import SQLiteKit

let databasePath = "/tmp/testdb.sqlite3"

do {
    let dbQueue = try SQLQueue.open(path: databasePath)
    dbQueue.didUpdate = { type, table, rowID in
        print("Did \(type) table \(table ?? "") rowID \(rowID)")
    try dbQueue.runSynchronously { db in
        try db.execute(sql: "CREATE TABLE IF NOT EXISTS Car (carID INTEGER PRIMARY KEY ASC, make TEXT NOT NULL, color TEXT NOT NULL);")

    var insertCar: SQLStatement?
    try dbQueue.runSynchronously { db in
        insertCar = try db.prepare(statement: "INSERT INTO Car (make, color) VALUES (?, ?);")
    dbQueue.transaction { db in
        try insertCar?.resetBindAndStep(values: .text("Ford"), .text("Red"))
        try insertCar?.resetBindAndStep(values: .text("Ferrari"), .text("Green"))
        try insertCar?.resetBindAndStep(values: .text("Volvo"), .text("Blue"))

        return .commit
    RunLoop.main.run(until: Date().addingTimeInterval(2))
} catch {


Stars: 0
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

First alpha version.
1 year ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API