Swiftpack.co - infinitetoken/Arcade as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Lightweight persistence engine for Swift structures
.package(url: "https://github.com/infinitetoken/Arcade.git", from: "v4.3.0")


Arcade is a lightweight persistence layer for Swift structures or objects!


Arcade can be installed using the Swift Package Manager. Add the following to your Package.swift file:

dependencies: [
    .Package(url: "https://github.com/infinitetoken/Arcade.git", from: "1.0.0")



Models (structures) in your project must conform to Storable.

import Arcade

struct Owner: Storable {

    static var table: Table = AppTable.owner

    var persistentId: String {
        // Return your models unique store ID
    var name: String?



The Table protocol defines the names of the tables in which to store your models.

import Arcade

enum AppTable: String, Table {
    case owner = "Owner"

    var name: String {
        return self.rawValue

Configure Adapter

import Arcade

let adapter = InMemoryAdapter()


import Arcade

let owner = Owner(id: id(), name: "Foo")

adapter.insert(storable: owner) { (result) in
    // Inserted! (or Error)


import Arcade

owner.name = "Fred"

adapter.update(storable: owner) { (result) in
    // Updated! (or Error)


import Arcade

let id = owner.id

adapter.delete(id: id, type: Owner.self) { (result) in
    // Deleted! (or Error)


To find a specific item by id:

import Arcade

adapter.find(id: owner.id) { (result) in
    // Found it! (or Error)

To query a set of items:

import Arcade

let expression = Expression.equal("name", "Foo")
let query = Query.expression(expression)

adapter.fetch(query: query) { (result) in
    // Do something with result... (or Error)


To use Arcade with the CoreData adapter some additional protocol conformance must be setup. Your CoreData entites should conform to CoreDataStorable:

class OwnerEntity: NSManagedObject {

    @NSManaged var id: id
    @NSManaged var name: String?

    override func awakeFromInsert() {

        self.id = id()


extension OwnerEntity: CoreDataStorable {

    public var storable: Storable {
        return Owner(id: self.id, name: self.name)

    public func update(with storable: Storable) -> Bool {
        if let id = storable as? id {
            self.id = id
        if let name = storable.name as? String {
            self.name = name

        return true


That's it! Now you can save your objects using the CoreDataAdapter just like any other object!


Arcade is released under the MIT license. See LICENSE for details.


Stars: 3
Last commit: Yesterday

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.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Related Packages

Release Notes


Remove empty from comparison

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