Coder Social home page Coder Social logo

predikit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

predikit's Issues

Parameters are bound to the wrong field

Let's say I have the following code:

let predicate = NSPredicate(Shipment.self) { includeIf in
    let includeIfState = includeIf.member(Selector(ShipmentRelationships.currentState.rawValue), ofType: State.self).string(Selector(StateAttributes.stateRaw.rawValue))

    let noOffer = includeIf.member(Selector(ShipmentRelationships.acceptedOffer.rawValue), ofType: Offer.self).equalsNil
    let cancelled = includeIfState.equals(State.State.Cancelled.rawValue)
    let expired = includeIf.number(Selector(ShipmentAttributes.pickupTimeTo.rawValue)).isLessThanOrEqualTo(soon)
    let sender = includeIf.member(Selector(ShipmentRelationships.sender.rawValue), ofType: Sender.self).equals(data)

    sender && noOffer && !cancelled && !expired
}

Unexpectedly, the resulting predicate is something like this:

sender == 1464553718.353965 AND acceptedOffer == nil AND (NOT currentState.stateRaw == "cancelled") AND (NOT pickupTimeTo <= <Sender: 0x7fe2cb708720> (entity: Sender; id: 0xd000000000080000 x-coredata://F5039107-C745-4046-B0B5-5F71ED5738B7/Sender/p2 ; data: {...}))

As you can see, the parameters of the sender and expired sub-predicates have been exchanged.

Side note: I'm using variables inside the block because this is a simplified example. In the actual code, the final predicate is composed of different sub-predicates depending on some filter parameter.

Minimal iOS version that PreditKit supports

I used PrediKit in two projects installed through CocoaPods.

In my new one I used Carthage and now XCode throws an error: Module file's minimum deployment target is ios8.3 v8.3: .../Carthage/Build/iOS/PrediKit.framework/Modules/PrediKit.swiftmodule/i386.swiftmodule

What I'm doing wrong or did in my previous two projects?

Installed in CocoaPods and having compile issues

Hello,
I installed it, and while running it in Swift 4.2, I keep getting the following error. I get it on both MemberQuery.swift and PredicateBuilder.swift

/Pods/PrediKit/Sources/Queries/MemberQuery.swift:48:26: Cannot invoke initializer for type 'String' with an argument list of type '(T.Type)'

Please Help!

Builder needs method for querying object properties

Case where we want to query an object with related objects, such as:

class Captain: NSObject {
    var name: String
}
class Ship: NSObject {
    var captain: Captain
}
NSPredicate(format: "captain == %@", someCaptain)
NSPredicate(format: "captain.name == 'Chief Supreme'")

There currently is no method to match an object property (example 1), or to match a related object's property (example 2).

Are there currently any plans for this?

Remove default implementation Reflectable for NSObject

Hi, I use your nice PrediKit to filter realm Results, works pretty good, but needs particular implementation of the properties() method
My variant:

extension Object: Reflectable {
    public static func properties() -> [Selector] {
        guard let schema = self.sharedSchema() else { return [] }
        let properties = schema.properties.map {
            Selector($0.name)
        }

        let computedProperties = schema.computedProperties.map {
            Selector($0.name)
        }

        return properties+computedProperties
    }
}

Problem is the following: Object inherited from NSObject, so I can't override your implementation in the NSObject extension

Swift 4.2 Compilation errors trying to build in Debug

In the latest swift migration there are two lies of code in #IF DEBUG blocks that weren't migrated along with the rest. This causes compilation errors when trying to build in debug.

I have the fix done locally for normal development, but it would be nice to fix for first pod installs and the like.

The problems are in MemberQuery.swift on line 48 and PredicateBuilder.swift on line 150. Both require changing String(type) to String(describing: type)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.