Why are ordered to-many relationships generated as OrderedSet?

When you use the "Create NSMangledObject subclass" feature in In Xcode 8 and Swift 3, any ordered to-many relationships are generated as OrderedSet. They should be NSMutableOrderedSet, as was handled properly by mogenerator.


Apple: Please explain. Surely we need to be able to modify those relationships without being forced to make wholesale changes.

What the generator creates is usually garbage and you always have to go make changes. You'll get something like NSSet instead of Set<Player> and you have to manually fix it.

Not only is Xcode's code generator garbage, but if you correct your relationship types to NSMutableOrderedSet (and probably also NSMutableSet) —your inverse relationships will no long get updated automatically as you add or remove objects in that set! This is absolutely insane. It literally cripples my app and affects hundreds of lines of code. Not a happy customer tonight... Is anyone at Apple even testing this in a Core Data app?

>Is anyone at Apple even testing this in a Core Data app?


They're perpetually busy working on the next cool thing™, apparently. It's up to hapless devs to test, I guess.

I think you might have more luck asking this over in App Frameworks > Core Data but, regardless, if this feature isn’t working the way you want it then you should file a bug against it.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Why are ordered to-many relationships generated as OrderedSet?
 
 
Q