Cheers,
I'm new to iOS development and tried to extend the master detail example of xcode with a searchbar. I already modeled a new entity which has several text fields and one of them is "name". I also created some hundreds of them and they are rendered just fine.
The searchbar is working just fine and I'm able to receive the entered text.
In a filter method triggered by searching I create this:
let predicate = NSPredicate(format: "name = %@", searchText);
self.fetchedResultsController.fetchRequest.predicate = predicate
do {
try self.fetchedResultsController.performFetch()
tableView.reloadData()
print("success")
} catch {
print("failed")
}
Afterwards I also reload my table. But the problem is, that the inside fetchedResultsController.fetchedObjects are not affected by my defined predicate. Probably I got the lifecycle wrong or need to clear something first. I did a massive research and couldn't figure out what is going on.
I also tried to set the predicate within the creation of the fetchedResultsController, but also didn't affect anything there. :-(
I also missunderstand the coredata / nsfetchedresultscontroller concept and would be glad to receive any insights and / or hints!
Regards,
Misha