I have a set of users in CoreData and an search field in my application. User has the properties firstname and name.
Currently I have a predicate like \"user.name CO
Swift 4 Update:
let firstName = NSPredicate(format: "firstName CONTAINS[c] %@", searchText)
let lastName = NSPredicate(format: "lastName CONTAINS[c] %@", searchText)
let orCompoundPredicate = NSCompoundPredicate(orPredicateWithSubpredicates:
[firstNamePredicate,lastNamePredicate]
Use the orCompoundPredicate while fetching data.