Let's say I have some data inside Core Data based on the following object:
class TestObject {
var name: String
var type: String
}
type can have one of the following names: "red", "green", "blue", "black".
Now I want to filter my data not based on one type, but an array of types, something like this:
public static func typePredicate(types: [String]) -> NSPredicate {
return NSPredicate(format: "type == %@", types) // this line should test for an array of types, not one type
}
Is this possible to do with NSPredicate ?