Kuery is an open source Swift library for Core Data from Kishikawa Katsumi that utilizes Swift 4’s Smart Keypaths.
With Kuery you have type safety, and code completion for your queries unlike when using NSPredicate directly.
These snippets from the readme show a couple of simple queries using NSPredicate:
NSPredicate(format: "name == %@", "Katsumi")
NSPredicate(format: "age > %@", 20)
NSPredicate(format: "age > %@", 20)
These are the same queries with Kuery:
Query(Person.self).filter(\Person.name == "Katsumi")
Query(Person.self).filter(\Person.age > 20)
Query(Person.self).filter(\Person.age > 20)
You can find Kuery on Github here.
A nice way to perform Core Data queries.
Original article: Kuery – A Swift 4 Library For Better Core Data Queries Using Smart Keypaths
©2017 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.