How to bind NSTreeController children to master data ordered for many relationships?

Apple introduced streamlined relationships for many relationships in Core Data at Lion. I created an object named TreeNode with a 1: 1-object-to-ratio ratio, a 1: 1-parent relationship, and children of the ordered many-relationship relationship.

Then I have an NSTreeController , and the path for the child keys is TreeNode.children. Launching the application shows only the elements of the first level. Therefore, children do not work. Since children are ordered for many relationships, the corresponding class has NSOrderedSet children. I added a custom method

 - (NSArray *) childrenArray { return [children array]; } 

in a TreeNode that works. I could not find documentation on this topic. Is this really the way to bind an NSTreeController to an ordered one in many relationships? Thanks in advance.

+8
cocoa core-data cocoa-bindings nstreecontroller
source share
1 answer

It seems that Apple gave us ordered sets for Core Data, but forgot to update its binding controllers. One year after your question, the problem still exists.

Take a look:

https://github.com/robertjpayne/DDOutlineView

The moral of the story. Be careful when using orderly relationships; try your own implementation until Apple fully implements this feature

+4
source share

All Articles