A Swift library that computes minimal edits between two collections, primarily for animating UITableView and UICollectionView updates.
Changeset is a Swift library that calculates the minimal edits required to transform one collection into another. It implements Dave DeLong's edit distance algorithm to detect additions, deletions, substitutions, and moves between two sets of equatable elements, solving the problem of efficiently animating data changes in iOS user interfaces.
iOS developers working with UITableView or UICollectionView who need to animate data updates smoothly and correctly according to Apple's batch update guidelines.
Developers choose Changeset because it provides a reliable, minimal-edit algorithm specifically designed for UIKit integration, with convenience extensions that simplify animated updates and support custom comparison logic for fine-grained control.
Minimal edits from one collection to another
Implements Dave DeLong's algorithm to compute the smallest set of changes (additions, deletions, substitutions, moves), ensuring smooth animations, as shown in the 'kitten' to 'sitting' example.
Provides direct integration with UITableView and UICollectionView through extensions like `tableView.update(with: changeset.edits)`, simplifying animated updates per Apple's batch update guidelines.
Allows custom comparison logic, such as always triggering changes for specific elements, enabling fine-grained animation control to prevent unwanted cell updates.
Offers a lightweight `edits` static method to compute edits without creating a full Changeset object, reducing overhead for performance-sensitive scenarios.
Tightly coupled with UIKit, with no support for SwiftUI or other frameworks, making it obsolete for modern iOS projects adopting declarative UI approaches.
Computing minimal edits can be slow for very large datasets, potentially impacting UI responsiveness during frequent updates, as the algorithm scales with collection size.
While custom comparators are supported, implementing advanced diffing logic requires deep understanding of the algorithm, adding complexity for non-trivial use cases.
A functional tool-belt for Swift Language similar to Lo-Dash or Underscore.js in Javascript
💻 A fast and flexible O(n) difference algorithm framework for Swift collection.
Swift type modelling the success/failure of arbitrary operations.
EKAlgorithms contains some well known CS algorithms & data structures.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.