SQLite alternatives and similar libraries
Based on the "Database" category.
Alternatively, view SQLite alternatives based on common mentions on social networks and blogs.
-
MMKV
An efficient, small mobile key-value storage framework developed by WeChat. Works on Android, iOS, macOS, Windows, and POSIX. -
GRDB.swift
A toolkit for SQLite databases, with a focus on application development -
YapDatabase
YapDB is a collection/key/value store with a plugin architecture. It's built atop sqlite, for Swift & objective-c developers. -
ParseAlternatives
GraphQLite is a toolkit to work with GraphQL servers easily. It also provides several other features to make life easier during iOS application development. [Moved to: https://github.com/relatedcode/GraphQLite] -
Couchbase Mobile
Lightweight, embedded, syncable NoSQL database engine for iOS and MacOS apps. -
FCModel
An alternative to Core Data for people who like having direct SQL access. -
UserDefaults
Simple, Strongly Typed UserDefaults for iOS, macOS and tvOS -
CTPersistance
iOS Database Persistence Layer with SQLite, your next Persistence Layer! -
Unrealm
Unrealm is an extension on RealmCocoa, which enables Swift native types to be saved in Realm. -
Prephirences
Prephirences is a Swift library that provides useful protocols and convenience methods to manage application preferences, configurations and app-state. UserDefaults -
RealmIncrementalStore
Realm-powered Core Data persistent store -
UserDefaultsStore
Why not use UserDefaults to store Codable objects 😉 -
PredicateEditor
A GUI for dynamically creating NSPredicates at runtime to query data in your iOS app. -
Nora
Nora is a Firebase abstraction layer for FirebaseDatabase and FirebaseStorage -
realm-cocoa-converter
A library that provides the ability to import/export Realm files from a variety of data container formats. -
SecureDefaults
Elevate the security of your UserDefaults with this lightweight ✨ wrapper that adds an additional layer of AES-256 encryption -
MySQL
A stand-alone Swift wrapper around the MySQL client library, enabling access to MySQL servers. -
PersistenceKit
Store and retrieve Codable objects to various persistence layers, in a couple lines of code! -
PersistentStorageSerializable
Swift library that makes easier to serialize the user's preferences (app's settings) with system User Defaults or Property List file on disk. -
YapDatabaseExtensions
YapDatabase extensions for use with Swift -
TypedDefaults
TypedDefaults is a utility library to type-safely use NSUserDefaults. -
MongoDB
A stand-alone Swift wrapper around the mongo-c client library, enabling access to MongoDB servers. -
ObjectiveRocks
An Objective-C wrapper for RocksDB - A Persistent Key-Value Store for Flash and RAM Storage. -
PostgreSQL
A stand-alone Swift wrapper around the libpq client library, enabling access to PostgreSQL servers. -
Storez
💾 Safe, statically-typed, store-agnostic key-value storage written in Swift! -
FileMaker
A stand-alone Swift wrapper around the FileMaker XML Web publishing interface, enabling access to FileMaker servers.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SQLite or a related project?
README
Perfect - SQLite Connector
This project provides a Swift wrapper around the SQLite 3 library.
This package builds with Swift Package Manager and is part of the Perfect project. It was written to be stand-alone and so does not require PerfectLib or any other components.
Ensure you have installed and activated the latest Swift 4.0 tool chain.
To learn more, you can read the full documentation guide here or jump to the example here
Linux Build Notes
Ensure that you have installed sqlite3.
sudo apt-get install sqlite3
Building
Add this project as a dependency in your Package.swift file.
.Package(url: "https://github.com/PerfectlySoft/Perfect-SQLite.git", majorVersion: 3)
Edge Case
If you encounter error like such sqlite3.h file not found
during $ swift build
, one solution is to install the sqlite3-dev i.e. $ sudo apt-get install libsqlite3-dev
Usage Example
Let’s assume you’d like to host a blog in Swift. First we need tables. Assuming you’ve created an SQLite file ./db/database
, we simply need to connect and add the tables.
let dbPath = "./db/database"
do {
let sqlite = try SQLite(dbPath)
defer {
sqlite.close()
}
try sqlite.execute(statement: "CREATE TABLE IF NOT EXISTS posts (id INTEGER PRIMARY KEY NOT NULL, post_title TEXT NOT NULL, post_content TEXT NOT NULL, featured_image_uri TEXT NOT NULL)")
} catch {
print("Failure creating database tables") //Handle Errors
}
Next, we would need to add some content.
let dbPath = "./db/database"
let postTitle = "Test Title"
let postContent = "Lorem ipsum dolor sit amet…"
do {
let sqlite = try SQLite(dbPath)
defer {
sqlite.close()
}
try sqlite.execute(statement: "INSERT INTO posts (post_title, post_content) VALUES (:1,:2)") {
(stmt:SQLiteStmt) -> () in
try stmt.bind(position: 1, postTitle)
try stmt.bind(position: 2, postContent)
}
} catch {
//Handle Errors
}
Finally, we retrieve posts and post titles from an SQLite database full of blog content. Each id, post, and title is appended to a dictionary for use elsewhere.
let dbPath = "./db/database"
var contentDict = [String: Any]()
do {
let sqlite = try SQLite(dbPath)
defer {
sqlite.close() // This makes sure we close our connection.
}
let demoStatement = "SELECT post_title, post_content FROM posts ORDER BY id DESC LIMIT :1"
try sqlite.forEachRow(statement: demoStatement, doBindings: {
(statement: SQLiteStmt) -> () in
let bindValue = 5
try statement.bind(position: 1, bindValue)
}) {(statement: SQLiteStmt, i:Int) -> () in
self.contentDict.append([
"id": statement.columnText(position: 0),
"second_field": statement.columnText(position: 1),
"third_field": statement.columnText(position: 2)
])
}
} catch {
//Handle Errors
}
Further Information
For more information on the Perfect project, please visit perfect.org.
*Note that all licence references and agreements mentioned in the SQLite README section above
are relevant to that project's source code only.