ReactiveCoreData
ReactiveCoreData copied to clipboard
Examples of how to use/replace NSFetchedResultsController with RCD
Lots of Core Data applications will use NSFetchedResultsController
to manage their UITableView
s and UICollectionView
s.
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 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 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.
For using NSFetchedResultsController with UITableView in ReactiveCocoa, see: https://github.com/AshFurrow/NSFetchedResultsController-MVVM
@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?
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 great!! thanks