16

One of the issues with updating results in a table view or collection view is that it can be difficult to visualize to the user exactly what has changed.

Here’s an open source library that makes it easier to visualize changes to a UITableView or UICollectionView called Doppelganger submitted by Sasha Zats.

To use Doppelganger you take your old datasource and provide the new datasource to the library choose how you’d like to animate the changes.

This source code example from the readme shows how it’s done:

NSArray *oldDataSource = self.dataSource;
self.dataSource = [self _updatedDataSource];
NSArray *diffs = [WMLArrayDiffUtility diffForCurrentArray:self.dataSource
                                            previousArray:oldDataSource];
[self.tableView wml_applyBatchChanges:array
                            inSection:0
                     withRowAnimation:UITableViewRowAnimationRight];

This animation shows the included Doppleganger example in action:

You can find Doppelganger on Github here.