Closed djbe closed 8 years ago
I completely forgot about this! I'll put one in tonight for you
Any opinions on syntax? At the moment you can achieve this by dropping down into strings as well. includeIf.string("captain.name").isEqualTo("Chief Supreme")
At the moment I'm thinking something along the lines of this:
NSPredicate(Ship.self) { includeIf in
includeIf.memberObject(Captain.self).string("name").isEqualTo("Chief Supreme")
}
@djbe
I think you’re sending messages to the wrong person.
Dario Pellegrini
http://www.dariopellegrini.com
Il giorno 27 mag 2016, alle ore 04:28, Hector Matos notifications@github.com ha scritto:
@djbe https://github.com/djbe — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/KrakenDev/PrediKit/issues/4#issuecomment-222045606, or mute the thread https://github.com/notifications/unsubscribe/AGJSY0XnG3TZqt19S7lrECRR8pgFCmCFks5qFlbcgaJpZM4IksGf.
Oops! Sorry but the username for the OP is @djbe. Is that yours as well?
GitHub is showing David Jennes for that username
I think it’s because I’ve set as favorite this library. Sorry, I didn’t remember that. However that’s not my username
Dario Pellegrini
http://www.dariopellegrini.com
Il giorno 27 mag 2016, alle ore 14:24, Hector Matos notifications@github.com ha scritto:
GitHub is showing David Jennes for that username
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/KrakenDev/PrediKit/issues/4#issuecomment-222133031, or mute the thread https://github.com/notifications/unsubscribe/AGJSY_m7amwKWS8VNm4Af2ZpUjGOUP6Fks5qFuJkgaJpZM4IksGf.
@dariopellegrini He was actually mentioning me, not you :-)
@hectormatos2011 Your syntax suggestion looks great, although I'd make a small change. I wouldn't work with the class type for properties, the property might have a different name (such as "captain1" or "reserveCaptain"). It might be better to just use strings for property names (until we get #selector syntax for getters):
includeIf.memberObject("captain").string("name").isEqualTo("Chief Supreme")
-->
NSPredicate(format: "captain.name == 'Chief Supreme'")
How would you handle the first predicate? You'd still need a call to test object equality, regardless of basic types. Something along the lines of:
includeIf.object("captain").isEqualTo(someCaptain)
-->
NSPredicate(format: "captain == %@", someCaptain)
I think I have an idea for it. I'll submit a PR and how would feel about reviewing it?
@djbe
Alright so I just pushed a new version. It should now be available in PrediKit 2.0.3.
@hectormatos2011 Looks great! I'll try to integrate PrediKit in one of our more complex apps and see if I hit any issues.
Sounds great! Feel free to continue creating issues! And let me know how it goes!
Case where we want to query an object with related objects, such as:
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?