ra1028 / DifferenceKit

💻 A fast and flexible O(n) difference algorithm framework for Swift collection.

Home Page:https://ra1028.github.io/DifferenceKit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CollectionDifference API implementation

maximkrouk opened this issue · comments

Checklist

Question

I want to mimic the behavior of CollectionDifference, so I started with

extension Array where Element: Differentiable {
    public func diff(from other: Array) -> StagedChangeset<Array> {
        StagedChangeset(source: self, target: other)
    }
}

And I'd like to implement Array.apply method, but I'm not sure what is the right way to apply StagedChangeset to an existing collection...

Also I'm looking for how to implement Array.diff(from:by:) method