lxcid / Listdiff
Licence: mit
Swift port of IGListKit's IGListDiff
Stars: ✭ 225
Programming Languages
swift
15916 projects
Labels
Projects that are alternatives of or similar to Listdiff
Split Diff
Side-by-side file compare for the Atom text editor.
Stars: ✭ 188 (-16.44%)
Mutual labels: diff
Openapi Diff
Utility for comparing two OpenAPI specifications.
Stars: ✭ 208 (-7.56%)
Mutual labels: diff
Mirrordiffkit
Graduation from messy XCTAssertEqual messages.
Stars: ✭ 168 (-25.33%)
Mutual labels: diff
Nbdime
Tools for diffing and merging of Jupyter notebooks.
Stars: ✭ 2,135 (+848.89%)
Mutual labels: diff
Ex audit
Ecto auditing library that transparently tracks changes and can revert them.
Stars: ✭ 214 (-4.89%)
Mutual labels: diff
Pytest Clarity
A plugin to improve the output of pytest with colourful unified diffs
Stars: ✭ 209 (-7.11%)
Mutual labels: diff
Docker Osm
A docker compose project to setup an OSM PostGIS database with automatic updates from OSM periodically
Stars: ✭ 172 (-23.56%)
Mutual labels: diff
Vim Mergetool
🍰 Efficient way of using Vim as a Git mergetool
Stars: ✭ 179 (-20.44%)
Mutual labels: diff
Swiftlcs
Swift implementation of the longest common subsequence (LCS) algorithm.
Stars: ✭ 207 (-8%)
Mutual labels: diff
Expdevbadchars
Bad Characters highlighter for exploit development purposes supporting multiple input formats while comparing.
Stars: ✭ 167 (-25.78%)
Mutual labels: diff
Htmlsimilarity
网页相似度判断:根据网页结构判断页面相似性 ,可用于相似度计算、越权检测等(Determine page similarity based on HTML page structure)
Stars: ✭ 189 (-16%)
Mutual labels: diff
Awesome Website Change Monitoring
A curated list of awesome tools for website diffing and change monitoring.
Stars: ✭ 224 (-0.44%)
Mutual labels: diff
Deck
decK: Configuration management and drift detection for Kong
Stars: ✭ 211 (-6.22%)
Mutual labels: diff
ListDiff
ListDiff is a Swift port of IGListKit's IGListDiff. It is an implementation of an algorithm by Paul Heckel that calculates the diff between 2 arrays.
Motivation
The motivation for this project came from the following challenge which I learnt about it from Ryan Nystrom's talk at iOSConf.SG.
Getting Started
swift package generate-xcodeproj
Installation
CocoaPods
pod 'ListDiff'
Carthage
github "lxcid/ListDiff" "master"
Usage
import ListDiff
extension Int : Diffable {
public var diffIdentifier: AnyHashable {
return self
}
}
let o = [0, 1, 2]
let n = [2, 1, 3]
let result = List.diffing(oldArray: o, newArray: n)
// result.hasChanges == true
// result.deletes == IndexSet(integer: 0)
// result.inserts == IndexSet(integer: 2)
// result.moves == [List.MoveIndex(from: 2, to: 0), List.MoveIndex(from: 1, to: 1)]
// result.changeCount == 4
Rationale
During the port, I made several decisions which I would like to rationalize here.
- Using caseless enum as namespace. See Erica Sadun's post here.
- No support for index paths. Decided that this is out of the scope.
-
Stack vs Heap. AFAIK, Swift does not advocates thinking about stack vs heap allocation model, leaving the optimization decisions to compiler instead. Nevertheless, some of the guideline do favour
struct
more, so onlyList.Entry
is a (final) class as we need reference to its instances.
Alternatives
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].