A Swift library for writing strongly-typed, readable, and flowable NSPredicate queries with auto-generated schemas.
PredicateFlow is a Swift library that provides a strongly-typed, fluent API for building NSPredicate queries. It solves the problem of writing error-prone, hard-to-read string-based predicates by auto-generating schema structures from your model classes, ensuring compile-time safety and improved readability. It integrates seamlessly with Realm for type-safe database queries.
iOS, macOS, tvOS, and watchOS developers using Swift who need to write complex NSPredicate queries for filtering data, especially those working with Core Data, Realm, or other predicate-based APIs.
Developers choose PredicateFlow because it eliminates runtime crashes from typos in predicate strings, provides autocompletion for attribute names and operations, and makes complex predicate logic readable and maintainable. Its integration with Sourcery automates schema generation, reducing boilerplate.
Write amazing, strong-typed and easy-to-read NSPredicate.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Eliminates runtime crashes by ensuring predicate attribute names and types are checked during compilation, as shown in the auto-generated schema examples from model classes.
Provides a chainable builder that transforms verbose NSPredicate strings into a natural Swift syntax, improving code maintainability for complex compound queries.
Uses Sourcery to automatically generate predicate property schemas from model classes, reducing manual boilerplate and ensuring consistency across the codebase.
Includes an optional module for type-safe Realm queries, allowing filter and sort operations with the same fluent API, as demonstrated in the README examples.
Mandates CocoaPods, a Sourcery dependency, and manual Xcode build phase configuration, which can be error-prone and adds significant setup overhead.
Officially supports only CocoaPods, ignoring Swift Package Manager or Carthage, which may alienate developers using modern Swift toolchains.
Requires dragging generated Swift files into the project and managing .gitignore patterns, introducing complexity in version control and team collaboration.