Issue
ContentView.rearrangeChildItems
has to clone the Core Data ordered set from an NSOrderedSet
to a NSMutableOrderedSet
before it can (using the moveObjects
to) be rearranged
There a performance impact (seems acceptable with up to ~50 items) which should not be necessary, as:
- According to the official documentation for the data modeller as it states: "Arrangement: Select the Ordered checkbox to specify that the relationship has an inherent ordering, and to generate an ordered mutable set.".
- The App's Core Data model uses that option for its children and parent relationships.
And yet XCode's (11.6 and 12 Beta 3) Editor> Create NSManagedObjectSubclass Subclass...
generates accessors for the sets in Item+CoreDataProperties
, it creates items that return immutable NSOrderedSet
.
Misc
In the hope that Core Data's mapping was simple screwy, I tried:
- casting to
NSMutableOrderedSet
in ContentView.rearrangeChildItems
.
- Changing the returned type in
Item+CoreDataProperties
for the lists ``NSMutableOrderedSet`
Neither worked, and from memory, built, allowed rearrangement, but then silently i.e. no exceptions or warnings, failed to persist the data.