Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Swift
  3. QueryKit

QueryKit

BSD-2-ClauseSwift0.14.0

A type-safe Core Data query language for Swift and Objective-C that simplifies database operations.

Visit WebsiteGitHubGitHub
1.5k stars87 forks0 contributors

What is QueryKit?

QueryKit is a Swift and Objective-C library that provides a type-safe query language for Core Data. It allows developers to construct database queries using Swift's expressive syntax and KeyPaths, making Core Data interactions more intuitive and less error-prone by replacing traditional string-based predicates.

Target Audience

iOS and macOS developers working with Core Data who want to write safer, more maintainable queries using Swift's type system and modern language features.

Value Proposition

Developers choose QueryKit over raw Core Data or string-based predicates because it offers compile-time type checking via Swift KeyPaths, reducing runtime errors and boilerplate code, while providing a fluent, chainable API for building complex queries.

Overview

A simple CoreData query language for Swift and Objective-C.

Use Cases

Best For

  • Building Core Data queries with compile-time type safety to prevent runtime predicate errors.
  • Chaining multiple filter and exclude operations to refine query results in a readable way.
  • Implementing pagination or limiting results using slicing and ordering functions.
  • Writing complex query conditions with logical operators (AND, OR, NOT) and range/inclusions.
  • Lazily evaluating queries to delay database execution until results are actually needed.
  • Migrating from string-based NSPredicate to a more expressive, Swift-native query syntax.

Not Ideal For

  • Projects using alternative persistence layers like Realm or raw SQLite, as QueryKit is tightly coupled with Core Data.
  • Simple apps with trivial data fetching needs where string-based NSPredicate suffices and the library overhead isn't justified.
  • Teams heavily invested in Objective-C without Swift adoption, since type-safe features rely on Swift KeyPaths.
  • Legacy codebases with extensive, complex NSPredicate logic that would require significant refactoring to migrate.

Pros & Cons

Pros

Compile-Time Type Safety

Uses Swift KeyPaths to build queries, ensuring property names and types are checked at compile time, which prevents runtime errors common with string-based predicates as highlighted in the README.

Expressive Query Chaining

Supports chaining multiple filter and exclude operations, allowing developers to construct complex queries in a readable, modular way, as demonstrated in the README examples.

Lazy Evaluation Optimization

QuerySets are lazily evaluated, delaying database execution until results are needed, which can improve performance by avoiding unnecessary fetches, as noted in the documentation.

Rich Operator Support

Extends KeyPaths with operators like ==, <<, and logical operators (&&, ||, !), enabling complex conditions without manually building NSPredicates, as detailed in the operators section.

Cons

Swift-Centric Design

While it supports Objective-C, the type-safe features depend on Swift KeyPaths, making it less intuitive for pure Objective-C projects, and the README admits fallback to NSPredicate for complex cases.

Abstraction Overhead

Adds an extra layer over Core Data, which might introduce minor performance overhead and obscure direct access to low-level Core Data APIs for advanced optimizations.

Limited Ecosystem and Updates

As a niche library focused on Core Data, it has fewer community resources, slower updates, and less integration with modern frameworks like SwiftUI or Combine compared to Apple-native solutions.

Frequently Asked Questions

Quick Stats

Stars1,456
Forks87
Contributors0
Open Issues6
Last commit5 years ago
CreatedSince 2014

Tags

#macos-development#query-builder#orm#objective-c#type-safe#ios-development#swift#core-data#database-queries

Built With

O
Objective-C
C
Core Data
S
Swift

Links & Resources

Website

Included in

Swift26.0k
Auto-fetched 18 hours ago

Related Projects

CoreStoreCoreStore

Unleashing the real power of Core Data with the elegance and safety of Swift

Stars4,052
Forks259
Last commit19 hours ago
SugarRecordSugarRecord

CoreData/Realm sweet wrapper written in Swift

Stars2,101
Forks220
Last commit5 years ago
GraphGraph

Graph is a semantic database that is used to create data-driven applications.

Stars872
Forks69
Last commit3 years ago
JSQCoreDataKitJSQCoreDataKit

A swifter Core Data stack

Stars615
Forks66
Last commit11 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub