How to implement search in a table view (with FRC)

耗尽温柔 提交于 2019-11-30 23:23:24

I think there are some conceptual errors regarding UITableViews and FRC. The FRC is just a class to get data from Core Data and together with the MOC ensure that it retains data integrity, even if you have a several tabs that access the same database concurrently , each doing their own updates. Behind the scenes there are processes in play to ensure that an update in one tab gets reflected in all the other tabs. What I am actually saying is there are consequences if you bypass the recommended method.

The performFetch output can be stored in cache and skips fetching if for some reason you need to do a [tableview reloadData]; You can certainly program to get the tableview get its data from multiple sources but I do not see any reason for doing this. If the only reason for multiple sources is to keep track of the results before the search, there should be a way to reset the predicate in order for the FRC to get all the (current) records. In the case of my app, putting all or all records in the searchbar, results in a predicate 1=1 which gets all the records. Again, this may not be that relevant in a single view app, but a tabbed app with a number of concurrent updates will require this to ensure data is current all across.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!