Iglistkit: Question about resultForBatchUpdates in IGListIndexSetResult.m

Created on 29 Dec 2016  路  1Comment  路  Source: Instagram/IGListKit

New issue checklist

General information

I'm trying to implement the diff part in Swift. I found this code in IGListIndexSetResult.m resultForBatchUpdates:

// convert all update+move to delete+insert
 const NSUInteger moveCount = moves.count;
    for (NSInteger i = moveCount - 1; i >= 0; i--) {
        IGListMoveIndex *move = moves[i];
        if ([filteredUpdates containsIndex:move.from]) {
            [filteredMoves removeObjectAtIndex:i];
            [filteredUpdates removeIndex:move.from];
            [deletes addIndex:move.from];
            [inserts addIndex:move.to];
        }
    }

In line 5, filteredMoves removes object at index i, since filteredMoves will change when enumerating, this cannot guarantee the specific IGListMoveIndex object will be removed. Was that on purpose?

question

Most helpful comment

I figured this out , the enumeration was reversed.

>All comments

I figured this out , the enumeration was reversed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andreamazz picture andreamazz  路  16Comments

rnystrom picture rnystrom  路  24Comments

rafalszastok picture rafalszastok  路  18Comments

aortegas picture aortegas  路  16Comments

rnystrom picture rnystrom  路  34Comments