Apple introduced ordered to-many-relationships in Core Data in Lion. I created an entity named TreeNode with an 1:1-object-relation, a 1:1-parent-relation and an ordered to-many-relationship children.
Then I have an NSTreeController
with the children key path set to TreeNode.children. Running the application only shows first level elements. So children is not working. Since children is an ordered to-many-relationship, the corresponding class has an NSOrderedSet
children. I added a custom method
- (NSArray *) childrenArray {
return [children array];
}
to TreeNode which works. I could not find any documentation concerning that topic. Is it really the way to go when binding NSTreeController
to an ordered to-many-relationship? Thanks in advance.