How to use Apple's TableViewUpdates collapsable table view with Core Data and NSFetchedResultsController?

82 Views Asked by At

I'm trying to use Apple's sample project with expand/collapse UITableView sections https://developer.apple.com/Library/ios/samplecode/TableViewUpdates/Introduction/Intro.html The problem is that I'm trying to use it with CoreData NSFetchedResultsController, and I don't know how to change Apple's code to work with it.

1

There are 1 best solutions below

0
On

The simple, if not very pleasant, answer is to store the expanded / collapsed status into the Core Data store and then use a predicate with the FRC request so you can change the store contents and it will automatically update the table.

Alternative could be to mutate the data you get from the FRC when the table view requests info from the delegate, which is also messy.

Depending on your data you could use multiple FRCs, one for each section, though this may not be very extensible.