TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Dec 2014 |
SPMSupports SPM | ✗ |
Maintained by André Lind.
Lightweight CoreData manager written in Swift
Breeze takes a lot of cues from both MagicalRecord and Nimble
Then import “Breeze.h” into your .pch file
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])
}
BreezeStore.saveInBackground { contextType -> Void in
let car = Car.createInContextOfType(contextType)
car.color = UIColor.blueColor()
}
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)
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)
Breeze is available under the MIT license. See the file LICENSE.