In iCloud, I want to search in Item's table, where I have userId column in swift but I didn't know how
Table: User
UserId {String type}
UserName {String type}
Table: Item
ItemId {String type}
ItemName {String type}
UserId {String type}
I need NSPredicate alternative to this query
Select * from item where userId in (2,3,4)
Also, is there any way so I can fire sql query directly in iCloud?
Is this is the correct way of doing above in Swift?
var orList = [NSPredicate]()
orList.append(NSPredicate(format: "userId = %i", 2))
orList.append(NSPredicate(format: "userId = %i", 3))
orList.append(NSPredicate(format: "userId = %i", 4))
Thanks-
Try this;
let usrIds:[Int] = [1,2,3];
let predicate:NSPredicate = NSPredicate(format: "userId IN %@", usrIds);