Using Realm DB in a fast application. I am trying to filter the results using a predicate as follows:
class func fetchUsersFromDB(usersId: [String]) -> [User]{ var users = [User]() let realm = Realm() let predicate = NSPredicate(format: "objectId IN %@", argumentArray: usersId) var allUsers = realm.objects(User).filter(predicate) users = Array(allUsers) return users }
But this does not compile. I get this error:
Terminating app due to uncaught exception 'Invalid value', reason: 'IN clause requires an array of items'
Any ideas what I'm doing wrong?
source share