Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Simple way to identify what is different between 2 instances of any type. Must have for TDD.
| Date | Stars |
|---|---|
| 2026-07-24 | 1245 |
| 2026-07-25 | 1245 |
| 2026-07-28 | 1245 |
| 2026-07-30 | 1245 |
| 2026-08-07 | 1244 |
| 2026-08-20 | 1244 |
| 2026-08-22 | 1243 |
| 2026-09-19 | 1242 |
| 2026-09-20 | 1242 |
Today
— stars today
This week
-1 stars this week
This month
-2 stars this month
Momentum
0.0
growth rate 0.00%/day
[](http://cocoapods.org/pods/Difference)
[](http://cocoapods.org/pods/Difference)
[](http://cocoapods.org/pods/Difference)
# Difference
Better way to identify what's different between 2 instances.
Have you ever written tests?
Usually they use equality asserts, e.g. `XCTAssertEqual`, what happens if the objects aren't equal? Xcode throws a wall of text at you:

This forces you to manually scan the text and try to figure out exactly what's wrong, what if instead you could just learn which property is different?

[**If you'd like to support my work and improve your engineering workflows, check out my SwiftyStack course**](https://www.swiftystack.com/)
## Installation
### CocoaPods
Add `pod 'Difference'` to your Podfile.
### Carthage
Add `github "krzysztofzablocki/Difference"` to your Cartfile.
### SwiftPM
Add `.package(url: "https://github.com/krzysztofzablocki/Difference.git", branch: "master")` dependency in your Package manifest.
## Using lldb
Write the following to see the difference between 2 instances:
`po dumpDiff(expected, received)`
## Integrate with XCTest
Add this to your test target:
```swift
public func XCTAssertEqual<T: Equatable>(_ expected: @autoclosure () throws -> T, _ received: @autoclosure () throws -> T, file: StaticString = #filePath, line: UInt = #line) {
do {
let expected = try expected()
let received = try received()
XCTAssertTrue(expected == received, "Found difference for \n" + diff(expected, received).joined(separator: ", "), file: file, line: line)
}
catch {
XCTFail("Caught error while testing: \(error)", file: file, line: line)
}
}
```
Replace `#filePath` with `#file` if you're using Xcode 11 or earlier.
## Integrate with Quick
Add this to your test target:
```swift
public func equalDiff<T: Equatable>(_ expectedValue: T?) -> Matcher<T> {
return Matcher.define { actualExpression in
let receivedValue = try actualExpression.evaluate()
if receivedValue == nil {
var message = ExpectationMessage.fail("")
if let expectedValue = expectedValue {
message = ExpectationMessage.expectedCustomValueTo("equal <\(expectedValue)>", actual: "nil")
}
return MatcherResult(status: .fail, message: message)
}
if expectedValue == nil {
return MatcherResult(status: .fail, message: ExpectationMessage.fail("").appendedBeNilHint())
}
return MatcherResult(bool: receivedValue == expectedValue, message: ExpectationMessage.fail("Found difference for " + diff(expectedValue, receivedValue).joined(separator: ", ")))
}
}
```
Write the following to see the difference between 2 instances:
`expect(received).to(equalDiff(expected))`
## Integrate with The Composable Architecture
If you are using The Composable Architecture `nameLabels` configuration to get a diff that's more appropiate for reducer instrumentation
```swift
diff(oldState, newState, indentationType: .pipe, nameLabels: .comparing)
```
You can use this function in your own variant of [ReducerInstrumentation code based on this](https://github.com/pointfreeco/swift-composable-architecture/blob/e7dda73c35f1016c8ba82fd2b7c43757cce68e58/Sources/ComposableArchitecture/Debugging/ReducerDebugging.swift)
That way your diffs will look more like this:
```swift
Received action:
AppAction.home(.howTo(.setSelectedSlide))
State:
home:
| selectedHowTo:
| | selectedSlide:
| | | Current: 8mnkni91h4fe
| | | Previous: exei4wpqsmdk
```
Excerpt of 3,806 characters
Read on GitHub38
15
8
4
Cihat Gündüz · @FlineDev · Germany
4
3
2
2
Hai Feng Kao
2
1
1
1
1
1
1
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:efd5c9f7d0dfce9b, topic:testing