Skip to content

Instantly share code, notes, and snippets.

@Czajnikowski
Last active June 3, 2017 10:48
Show Gist options
  • Save Czajnikowski/2c3d3400bbdbc3f2c9c48ccf12001d11 to your computer and use it in GitHub Desktop.
Save Czajnikowski/2c3d3400bbdbc3f2c9c48ccf12001d11 to your computer and use it in GitHub Desktop.
let fetchRequest = NSFetchRequest<Contact>(
entityName: Contact.entity().name!
)
fetchRequest.predicate = NSCompoundPredicate(
orPredicateWithSubpredicates: [
"name",
"surname",
"city"
]
.map {
NSPredicate(
format: "SELF.%K == %@",
$0,
searchQuery
)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment