Binding an Ordered Relationship with an NSArrayController

前端 未结 2 758
野性不改
野性不改 2020-12-29 12:35

How does one bind an NSArrayController\'s content to the entities in an ordered to-many relationship?

I have an unordered to-many relationship in my Core Da

2条回答
  •  执笔经年
    2020-12-29 13:12

    The fundamental problem is that a Core Data ordered to-many relationship returns an NSOrderedSet, and NSOrderedSet is not a subclass of NSSet. Any array controller bindings that expect an NSSet will fail.

    Tom Fewster has a detailed blog post describing the use of NSValueTransformer to work around this shortcoming, converting between NSOrderedSet and NSArray on the fly. He also provides a sample implementation on Github.

提交回复
热议问题