Compute differences between two sequences of elements.
These can be passed to updateSection
extensions to animate transitions.
// Update self.items array of view models
let previous: [ViewModel] = self.items
self.items = model.currentViewModels()
let diff = previous.diff(self.items)
// Animate changes to view models array
self.tableView.beginUpdates()
self.tableView.updateSection(0, diff: diff)
self.tableView.endUpdates()
ElementDiff is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ElementDiff"
- 0.3.0 - 2016-09-03 - Remove
reloadRowsAtIndexPaths
- 0.2.1 - 2016-03-04 - Make ElementDiff struct fields vars
- 0.2.0 - 2015-12-22 - Allow for using custom identifier
- 0.1.0 - 2015-12-12 - Initial public release
- 0.0.0 - 2015-07-29 - Initial private version for project at Q42
ElementDiff is written by Tom Lokhorst of Q42 and available under the MIT license, so fee free to use it in commercial and non-commercial projects.