Skip to content

v5.1.0

Choose a tag to compare

@ffried ffried released this 28 Jul 07:01
e548483

This release adds convenience APIs for fetching and creating Fetchable and Creatable Models using Swift KeyPaths and Operators.

E.g.:

final class MyModel: NSManagedObject, FindOrCreatable {
    let hasContent: Bool
    let validTo: Date?
}

let context = CoreDataStack.mainContext
let models = try MyModel.find(in: context, where: \.hasContent == true && \.validTo >= Date(), sortedBy: ^\.validTo)
let newModel = try MyModel.findOrCreate(in: context, where: \.hasContent != true)