Some time ago I mentioned the ObjectiveRecord library providing an active record implementation for managing Core Data objects in Objective-C.
Here’s an open source Swift library inspired by ObjectiveRecord providing an implementation of ActiveRecord with a number of nice features from Zaid Daghestani called SwiftRecord.
SwiftRecord provides easy queries, creation, deletion, and saving and you can use dictionaries.
Here is an example from the readme demonstrating the query syntax:
var events = Event.all() as! [Event]
// all past events before now
var pastEvents = Event.query("when < %@", NSDate()) as! [Event]
// specific event, yes we have support for format&arguments. Note, finding specific events return optional vars
var thisEvent = Event.find("name == %@ AND when == %@", "productQA", NSDate()) as? Event
// Use dictionaries to query too
var birthdayEvents = Event.query(["type":"birthday"]) as! [Event]
// or NSPredicates
var predicate = NSPredicate("type == %@", "meeting")
var meetingEvents = Event.query(predicate) as! [Event]
You can find SwiftRecord on Github here.
A great library for working with Core Data in Swift.