Can someone provide better contains() usage documentation? #7610
Unanswered
rromanchuk
asked this question in
Q&A
Replies: 2 comments 5 replies
-
I think what you want is .where { $0.assignee.containsAny(in: ["Ali", "Jamie"]) } This produces the NSPredicate string |
Beta Was this translation helpful? Give feedback.
1 reply
-
@rhys-rantmedia |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I don't understand how the example is showing, what i assumed would be a typed equivalent to
.filter("assignee IN %@", ["Ali", "Jamie"])
This just seems like a much more annoying way to write
.where { $0.assignee == "Ali" || $0.assignee == "Jamie" }
For example, how would you compose
.filter("challenge.id == %@ && (status IN %@ || gave_up == true)", challengeId, [PlayerStatus.kicked_out.rawValue, PlayerStatus.left.rawValue])
I would assume the block would look something like this
.where { [.left, .kicked_out].contains($0.status) }
If anyone has more realistic examples to get me going, before I head to the reference docs, which is dense with generics, i'll give you a 🥇Beta Was this translation helpful? Give feedback.
All reactions