Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fatuhoku opened this issue Apr 2, 2014 · 6 comments
Open

Comments

@fatuhoku
Copy link

fatuhoku commented Apr 2, 2014

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
Copy link
Owner

@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
Copy link
Author

fatuhoku commented Apr 5, 2014

!!! @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
Copy link

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

@juzooda
Copy link

juzooda commented Feb 9, 2015

@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
Copy link
Author

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
Copy link

juzooda commented Feb 11, 2015

@fatuhoku great!! thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants