Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 6566b7a

Browse files
committed
Use asdk_inverseCompare: to reverse sort the array of index path's to delete
1 parent 3e4b5e9 commit 6566b7a

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

AsyncDisplayKit/Details/ASDataController.mm

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -816,11 +816,9 @@ - (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withAnimationOptions:(ASDat
816816
[_editingTransactionQueue waitUntilAllOperationsAreFinished];
817817

818818
// Sort indexPath in order to avoid messing up the index when deleting in several batches.
819-
NSArray *sortedIndexPaths = [indexPaths sortedArrayUsingSelector:@selector(compare:)];
820-
821819
// When you delete at an index, you invalidate all subsequent indices, and we never want to use an invalid index
822820
// in a later delete so we should have the sorted index path's array in descendent order
823-
sortedIndexPaths = [[sortedIndexPaths reverseObjectEnumerator] allObjects];
821+
NSArray *sortedIndexPaths = [indexPaths sortedArrayUsingSelector:@selector(asdk_inverseCompare:)];
824822

825823
[_editingTransactionQueue addOperationWithBlock:^{
826824
LOG(@"Edit Transaction - deleteRows: %@", indexPaths);

0 commit comments

Comments
 (0)