I have an array of integers:
▿ 2 elements - [0] : 123459 - [1] : 1031020
And I would like to filter my objects based on an array.
.filter("code IN \(myCodeArray)")
But this leads to a failure. How to use the IN operator?
Instead of using string interpolation of strings, you should use support for argument substitution NSPredicatethrough %@:
NSPredicate
%@
.filter("code IN %@", myCodeArray)
Swift ("\(someVariable)") . [123459, 1031020], NSPredicate. %@ , , Swift NSPredicate.
"\(someVariable)"
[123459, 1031020]