🔍 Using NSArray with CONTAINS NSPredicates
NSPredicate
's predicateWithFormat
method takes a va_list
of arguments, so it's not possible to pass an array to your format string. But, the same result can be achieved by combining multiple NSPredicate
s together using an NSCompoundPredicate
:
Given a space-separated array of search words:
You can combine them by first creating multiple predicates:
And finally create one NSPredicate
via NSCompoundPredicate