Use NSCompoundPredicate to retrieve data
When it comes to searching(or retrieve data) in coredata database with multiple conditions, create multiple prediates, use NSCompoundPredicate to combine them,
1 | let titlePredicate = NSPredicate(format: "title CONTAINS %@", keyword) |
now use this compound predicate to filter data the way you wanted
1 | let request: NSFetchRequest<entityName> = entityName.fetchRequest() |
⚠️ fetch request could be potential errors so make sure use a do-catch statement.
Also the NSPredicate cheatsheet: