ReactiveCoreData icon indicating copy to clipboard operation
ReactiveCoreData copied to clipboard

Examples of how to use/replace NSFetchedResultsController with RCD

Open fatuhoku opened this issue 10 years ago • 6 comments

Lots of Core Data applications will use NSFetchedResultsController to manage their UITableViews and UICollectionViews.

It provides a good level of control through its delegate protocol, and lets the user update tables relatively easily with some boilerplate code supplied by the Apple documentation.

Where does RCD come in on this matter?

fatuhoku avatar Apr 02 '14 11:04 fatuhoku

@fatuhoku The funny thing is that I don't program much for iOS. My focus is on my applications. Mac's AppKit doesn't have the NSFetchedResultsController. As such I don't know enough about this topic to give a meaningful answer. I hope somebody with experience in this subject will find a meaningful answer. Sorry about that.

apparentsoft avatar Apr 04 '14 15:04 apparentsoft

!!! @apparentsoft there is absolutely no need to apologise! I guess I run on the assumption that the community around Core Data / ReactiveCocoa related projects are going to be mainly iOS devs.

Well for anyone thinking the same thing, I think NSFetchedResultsController provides a good level of 'reactivity' through its own boilerplate.

When using UICollectionView it'd be useful to check out the category UICollectionView-NSFetchedResultsController. This approach doesn't use RCD.

fatuhoku avatar Apr 05 '14 13:04 fatuhoku

For using NSFetchedResultsController with UITableView in ReactiveCocoa, see: https://github.com/AshFurrow/NSFetchedResultsController-MVVM

simonyangme avatar Jul 31 '14 07:07 simonyangme

@apparentsoft I am trying to use the lib to keep my CollectionView updated with my coredata entity, but still with no success, i am new with ReactiveCocoa too, i would like to know how can i be notified when some event change my entity. i see the fetchWithTrigger is an array of command signals, i wouldn't like to watch the commands, but the database itself?

juzooda avatar Feb 09 '15 18:02 juzooda

You should just observe the NSNotification Core Data emits in that case. e.g. NSManagedObjectContextObjectsDidChangeNotification has a userInfo containing a bunch of useful information that tells you when some data has changed.

Check out: http://stackoverflow.com/questions/2463950/iphone-coredata-how-can-i-track-observe-all-changes-within-a-subgraph

fatuhoku avatar Feb 10 '15 15:02 fatuhoku

@fatuhoku great!! thanks

juzooda avatar Feb 11 '15 18:02 juzooda