Latest 0.7.0
Homepage https://github.com/kishikawakatsumi/RealmTypeSafeQuery
License Apache 2.0
Platforms ios 8.0, osx 10.9, watchos 2.0, tvos 9.0, requires ARC
Dependencies RealmSwift
Authors


Build Status


Codecov


Pods Version


Platforms


Carthage Compatible


Swift 3.x


Swift 4.0

A type-safe Realm query extensions using Swift 4’s Smart KeyPaths.

Requirements

RealmTypeSafeQuery is written in Swift 4.

Installation

CocoaPods

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

pod 'RealmTypeSafeQuery'

Carthage

For Carthage, add the following to your Cartfile:

github "kishikawakatsumi/RealmTypeSafeQuery"

Description

RealmTypeSafeQuery provides type safety, code completion and avoidance of typos against NSPredicate queries.

Before

realm.objects(Person.self).filter("name == %@", "Katsumi")
realm.objects(Person.self).filter("age > %@", 20)

After

realm.objects(Person.self).filter(Person.name == "Katsumi")
realm.objects(Person.self).filter(Person.age > 20)

The following code should be a compile error.

realm.objects(Person.self).filter(Person.name > 20) // Compile error
realm.objects(Person.self).filter(Dog.name == "John") // Compile error

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": "RealmTypeSafeQuery",
    "version": "0.7.0",
    "summary": "A type-safe Realm query extensions using Swift 4 Smart KeyPaths",
    "description": "RealmTypeSafeQuery provides type safety, code completion and avoidance of typos against `NSPredicate` queries.nnExamples:n```swiftnrealm.objects(Person.self).filter(Person.name == "Katsumi")nrealm.objects(Person.self).filter(Person.age > 20)nnrealm.objects(Person.self).filter(Person.name > 20) // Compile errornrealm.objects(Person.self).filter(Dog.name == "John") // Compile errorn```",
    "homepage": "https://github.com/kishikawakatsumi/RealmTypeSafeQuery",
    "license": {
        "type": "Apache 2.0",
        "file": "LICENSE"
    },
    "authors": {
        "Kishikawa Katsumi": "[email protected]"
    },
    "social_media_url": "https://twitter.com/k_katsumi",
    "requires_arc": true,
    "source": {
        "git": "https://github.com/kishikawakatsumi/RealmTypeSafeQuery.git",
        "tag": "v0.7.0",
        "submodules": true
    },
    "source_files": "RealmTypeSafeQuery/*.{h,swift}",
    "dependencies": {
        "RealmSwift": [
            "~> 3.0"
        ]
    },
    "pod_target_xcconfig": {
        "SWIFT_WHOLE_MODULE_OPTIMIZATION": "YES",
        "APPLICATION_EXTENSION_API_ONLY": "YES"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This