Using NSFetchedResultsController with many-to-many relationship
Using NSFetchedResultsController with many-to-many relationship
- Subject: Using NSFetchedResultsController with many-to-many relationship
- From: Glen Huang <email@hidden>
- Date: Sat, 10 Mar 2018 16:47:05 +0800
Hi,
I have two models: Person and Club. They have a many-to-many relationship. I
want to display all people in a table view sectioned by clubs (which means
there might be duplicate people across sections). I wonder how to do that with
NSFetchedResultsController? NSFetchRequest never returns the same object more
than once.
One solution I can come up with is to use multiple NSFetchedResultsController,
one for each section(club). But in my case people are editable, so I’d like to
also track changes. Listen to multiple NSFetchedResultsController seems pretty
cumbersome if not impossible (especially with regard to the adding or removing
of clubs, either because everyone leaves a club or a person joins a new club).
I wonder if there is a direct way to achieve that or a better way to
approximate?
Best
Glen
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden