khanlou/NSArray-LongestCommonSubsequence — pull request #1 by planetbeing (2014-03-11 07:01:03+00:00)
Title: Corrected indexesOfCommonElementsWithArray for row insertion.

Hi! Thanks a lot for your work on this. I was looking for something like this to use. I found that indexesOfCommonElementsWithArray:addedIndexes:removedIndexes: was not returning values for addedIndexes that could be used with insertRowsAtIndexPaths:withRowAnimation:. This resulted in some of the funkiness that could be easily seen when trying out the demo in SKViewController. I think that actually explains the problems with it, not any UITableView bugs. I wrote a patch that seems to fix the problems and changed your UITableView tests so that it actually checks the results.

- Changed indexesOfCommonElementsWithArray to return addedIndexes in the format insertRowsAtIndexPaths:withRowAnimation: expects. It expects the provided index paths to be valid when considered from the point of view of the final table data, not from the point of view of the initial table data. i.e., at the end of the updates, tableView:cellForRowAtIndexPath: for each of the provided index paths must return the rows that were inserted.
- Added tests to verify adding, removing and reordering elements behaves as expected on an actual UITableView.