apparentsoft / ReactiveCoreData

Core Data with ReactiveCocoa
MIT License
254 stars 15 forks source link

Examples of how to use/replace NSFetchedResultsController with RCD #4

Open fatuhoku opened 10 years ago

fatuhoku commented 10 years ago

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?

apparentsoft commented 10 years ago

@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.

fatuhoku commented 10 years ago

!!! @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.

simonyangme commented 10 years ago

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

juzooda commented 9 years ago

@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?

fatuhoku commented 9 years ago

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

juzooda commented 9 years ago

@fatuhoku great!! thanks