Swiftpack.co -  Fidetro/Swift-FFDB as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Fidetro/Swift-FFDB
a Object/Relational Mapping (ORM) support to iOS and MacOS .Since SwiftFFDB is build on top of FMDB.
.package(url: "https://github.com/Fidetro/Swift-FFDB.git", from: "2.3")

SwiftFFDB

中文文档


SwiftFFDB is a Object/Relational Mapping (ORM) support to iOS and Perfect-Server library.Since SwiftFFDB is build on top of FMDB.
if you use Objective-C,you can use FFDB

Wiki

More examples of usage in the wiki(unfinished)

Requirements

iOS

  • Build Swift5.0 releases toolchain
  • Deployment on iOS 8 or above
  • depend FMDB

Installing

CocoaPod

SwiftFFDB can be installed using CocoaPod

$ vim Podfile

Then,edit the Podfile,add SwiftFFDB:

platform :ios, '8.0'
target 'YouApp' do
use_frameworks!
pod 'SwiftFFDB'
end

Useage

Setting

You can check out the example project if you use in iOS:

Person.registerTable() //create table

Create

create table model would you look like this:

struct Person:FFObject {
    var primaryID: Int64?
    
    var name : String?
    
    static func ignoreProperties() -> [String]? {
        return nil
    }
    
    static func customColumnsType() -> [String : String]? {
        return nil
    }
    
    static func customColumns() -> [String : String]? {
        return nil
    }

    static func autoincrementColumn() -> String? {
        return "primaryID"
    }
}

Insert

var person = Person()
person.name = "fidetro"
person.insert()

Select

// find all Object
Person.select(where: nil)
// find name is 'fidetro' 
Person.select(where: "name = 'fidetro'")

Update

// update name is 'fidetro' to 'ffdb'
Person.update(set: "name = ?", where: "name = ?", values: ["ffdb","fidetro"])  

Delete

// find name is 'fidetro' 
let personList = Person.select(where: "name = 'fidetro'")

for (let person in personList){
    // delete this person in database
    person.delete()
}

also you can:

FFDBManager.delete(Person.self, where: "name = 'fidetro'")

Architecture

Support

SwiftFFDB is a personal open source project,but I happy to answer questions in Issues or email to zykzzzz@hotmail.com

GitHub

link
Stars: 18
Last commit: 5 weeks 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.

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