Using CoreData, I have an entity "Bookmark", that has an to-many relationship named 'tags' to another entity "Tag", and some commun attributes (string, date, ...).
In a NSTableView we display the Bookmarks entity via Binding:
- the NSArrayController is binded to File's Owner.managedObjectContext (standard XCode CoreData template, the managedObjectContext is in the AppDelegate)
- The columns in TableView are binded to their respective attribute. In particular the Tag column is binded to this arrayController.arrangedObjects.tags with a subclass of NSValueTransformer so that we can show, as an NSString, a summary of the to-many relationship.
It work. Now when I click on column header the whole table view get sorted correctly except for the 'tag' column where I get this:
-[_NSFaultingMutableSet compare:]: unrecognized selector sent to instance
For sure the "Set" from this to-many relationship doesn't respond to the selector 'compare:'.
Question: How can I make this work ? How can I sort on a to-many relationship ?
Are something like the ValueTransformer available ? If I could supply a custom class that would do the compare: for the ArrayController to know...