CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

Breeze 0.0.1

Breeze 0.0.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Dec 2014
SPMSupports SPM

Maintained by André Lind.



Breeze 0.0.1

Breeze

Lightweight CoreData manager written in Swift

Breeze takes a lot of cues from both MagicalRecord and Nimble

  • Lightweight and simple to setup and use
  • 1 row of code to find first/any object in database
  • iCloud support
  • Simple architecture using only a main and a background context.

Install

Then import “Breeze.h” into your .pch file

Setup

First, setup either a local or a iCloud store

if BreezeStore.iCloudAvailable() {
    BreezeStore.setupiCloudStoreWithContentNameKey("iCloudTestContentName", localStoreName: "iCloudTest", transactionLogs: "iCloud_transactions_logs")
} else {
    BreezeStore.setupStoreWithName("Test", type: NSSQLiteStoreType, options: [NSMigratePersistentStoresAutomaticallyOption: true, NSInferMappingModelAutomaticallyOption: true])
}

Saving

BreezeStore.saveInBackground { contextType -> Void in
    let car = Car.createInContextOfType(contextType)
    car.color = UIColor.blueColor()
}

Finding

Find single objects by attribute

let car = Car.findFirst(attribute: "myAttribute", value: 1, contextType: BreezeContextType.Main)

or by predicate

let car = Car.findFirst(predicate: myPredicate, sortedBy: "anotherAttribute", ascending: false, contextType: BreezeContextType.Main)

Likewise, find all objects by attribute

let cars = Car.findAll(attribute: "myAttribute", value: 1, contextType: BreezeContextType.Main)

or by predicate

let cars = Car.findAll(predicate: myPredicate, sortedBy: "anotherAttribute", ascending: false, contextType: BreezeContextType.Main)

Counting

If you just need to count the objects of a query, use the countAll function

let carCount = Car.countAll(predicate: myPredicate, sortedBy: "anotherAttribute", ascending: false, contextType: BreezeContextType.Main)

License

Breeze is available under the MIT license. See the file LICENSE.