I¹m running into two issues with moving items in NSMutableOrderedSet: 1. To get around the non-functional autogenerated accessors for ordered sets in CoreData, I use mutableOrderedSetValueForKey and call moveObjectsAtIndexes:toIndex:. Apparently this first removes the values, then inserts them at the specified index. Unfortunately, the former triggers a KVO which causes an out or range exception at the receiver of the notification, rather than waiting until both operations are executed. 2. moveObjectsAtIndexes:toIndex: does not do what one would expect. You would expect that the listed indexes would be moved to the specified index location in the existing list. That is not what it does. Again, it apparently removes them from the list first, then attempts to insert them at the specified index location, which is now wrong if any of the moved items are prior to the insert index. Instead, to make it work right, you have to figure out how many of the moved items are prior to the insert index, then subtract that from the index to get the correct insert location. Why wasn¹t this built into the moveObjectsAtIndexes:toIndex: method? You are making a single call to do this and, IMHO, it should have moved the items to the location specified in the original list, not the half-method post-removal location.
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com