0

I would like to create a CKQueryOperation that finds records where an array contains any items from another array. It does not need to contain all of the elements from the second array, just at least one.

I have this line which works for an array containing a string but I can not seem to find what I am looking for.

let pred = NSPredicate(format: "keywords CONTAINS 'myWord'")
let sort = NSSortDescriptor(key: "orderNumber", ascending: true)
let query = CKQuery(recordType: "Records", predicate: pred)

Thank you

Tom Coomer
  • 6,227
  • 12
  • 45
  • 82

1 Answers1

0
  1. let predicate: NSPredicate = NSPredicate(format: "ANY your_array == %@", predicateObject) - find one object in your array.

  2. let predicate: NSPredicate = NSPredicate(format: "ANY your_array IN %@", [predicateObject]) - find any object in your array.

סטנלי גרונן
  • 2,917
  • 23
  • 46
  • 68