Latest 0.2.0
Homepage https://github.com/kishikawakatsumi/Kuery
License MIT
Platforms ios 10.0, watchos 3.0, tvos 10.0, osx 10.12
Frameworks Foundation, CoreData
Authors

Build Status
Carthage compatible
Version
Platform

Kuery, a type-safe Core Data query API using Swift 4’s Smart KeyPaths. Inspired and borrowed a lot of things from QueryKit and RealmEx.

Requirements

Kuery is written in Swift 4.

Installation

CocoaPods

Kuery is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'Kuery'

Carthage

For Carthage, add the following to your Cartfile:

github "kishikawakatsumi/Kuery"

Usage

context.perform {
    let results = try Query(Person.self)
        .filter(Person.name == "Katsumi")
        .execute()
}
context.perform {
    let results = try Query(Person.self)
        .filter(Person.age == 36)
        .execute()
}
context.perform {
    let results = try Query(Person.self)
        .filter(Person.age > 20)
        .execute()
}
context.perform {
    let results = try Query(Person.self)
        .filter(Person.name == "Katsumi")
        .filter(Person.age == 36)
        .execute()
}
context.perform {
    let results = try Query(Dog.self)
        .filter(Dog.owner == person)
        .execute()
}

Feature request for Swift Standard Library

It requires a string representation of KeyPath to construct NSPredicate from KeyPath. However, the API is not officially visible currently. The feature request is tracked at SR-5220.

[SR-5220] Expose API to retrieve string representation of KeyPath – Swift

Latest podspec

{
    "name": "Kuery",
    "version": "0.2.0",
    "summary": "A type-safe Core Data query API using Swift 4's Smart KeyPaths.",
    "description": "Kuery, a type-safe Core Data query API using Swift 4's Smart KeyPaths.",
    "homepage": "https://github.com/kishikawakatsumi/Kuery",
    "source_files": "Sources/Kuery/*.swift",
    "pod_target_xcconfig": {
        "SWIFT_WHOLE_MODULE_OPTIMIZATION": "YES",
        "APPLICATION_EXTENSION_API_ONLY": "YES"
    },
    "frameworks": [
        "Foundation",
        "CoreData"
    ],
    "source": {
        "git": "https://github.com/kishikawakatsumi/Kuery.git",
        "tag": "v0.2.0"
    },
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kishikawa Katsumi": "[email protected]"
    },
    "social_media_url": "https://twitter.com/k_katsumi",
    "platforms": {
        "ios": "10.0",
        "watchos": "3.0",
        "tvos": "10.0",
        "osx": "10.12"
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This