DrunkenBeard
DrunkenBeard

Reputation: 410

NSFetchedResultsController in Master-Detail application

I'm trying to implement NSFetchedResultsController in my application. Currently I have a master table view and then when the user selects an item the detail view shows a collection view. The collectionView items will vary depending on the table view selected item.

I have a nice model that takes care of all of this. Basically a Presentation entity having a 1-to-n relationship with a Slide entity.

The way I do this now (before NSFetchedResultsController) is that I populate an NSArray with my presentations when the application starts, and then when the user selects a presentation on the master view I pass the relevant Presentation object to the collection view so it can show the slides. Pretty straightforward.

My question is how do I do that with an NSFetchedResultsController? Do I pass the entire NSFetchedResultsController object from master to detail along with some reference to the presentation so I can show the slides? Or do I only pass the Presentation object same as before? I'm still not comfortable with the inner workings of NSFetchedResultsController so I'd like to be sure I'm respecting best practices.

Thanks

Upvotes: 0

Views: 117

Answers (1)

Nikita Took
Nikita Took

Reputation: 4012

Just pass data as usual. If your collectionView needs Presentation object to populate itself, you can pass it.

Also, if you care about NSManagedObjectContext in which Presentation is, you can pass its ManagedObjectId and refetch it in collectionViewController.

Upvotes: 1

Related Questions