Build
Connect & operate
Design & teams
Start hereScope a build in one callBring a spec, a wireframe, or a paragraph. You leave with an architecture, a timeline, and a number.Book a scoping call
AI software
LLM & data systems
Vibe coding
Ready to ship?Put AI where the work isAgents, RAG, and private LLMs wired into the systems your team already uses — not a chatbot bolted to a homepage.Discuss an AI project
Domain firstWe learn your workflow before we model itRegulated, operational, or high-volume — the constraints belong in the schema, not in a training doc.Talk about your domain
Plan smarterEstimate before you commitCost ranges, scope templates, and the questions we ask in discovery — free, no form.Open the cost calculator
Real conversationsTalk with a technical leadNo SDR, no discovery gauntlet. The person on the call is the one who scopes the build.Book a call
Open-Source Testing · krzysztofzablocki

Difference

Difference is a Swift testing utility that displays property-level diffs when object comparisons fail, replacing cryptic assertion output with clear, readable differences. It integrates with XCTest, Quick, and The Composable Architecture, supporting iOS, macOS, tvOS, and watchOS.

Source: GitHub — github.com/krzysztofzablocki/Difference
1.2k
GitHub stars
59
Forks
Swift
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorykrzysztofzablocki/Difference
Ownerkrzysztofzablocki
Primary languageSwift
LicenseMIT — OSI-approved
Stars1.2k
Forks59
Open issues5
Latest release1.1.0 (2024-08-05)
Last updated2025-05-08
Sourcehttps://github.com/krzysztofzablocki/Difference

What Difference is

A reflection-based diff library for Swift that introspects Equatable types and generates human-readable diffs of mismatched properties. Provides lldb command support, custom XCTest assertion overrides, and matcher integration for BDD frameworks.

Quickstart

Get the Difference source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/krzysztofzablocki/Difference.gitcd Difference# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Test-Driven Development (TDD) Workflows

Accelerates test failure diagnosis by isolating which properties differ, reducing manual scanning of assertion output and shortening debugging cycles.

State Management Debugging

Integrates with The Composable Architecture to visualize state mutations in reducer instrumentation, displaying only changed fields in hierarchical format.

Complex Object Comparison Testing

Ideal for testing domain models with many properties; quickly identifies which fields broke, especially valuable when comparing API responses or data transformations.

Implementation considerations

  • Requires explicit Equatable conformance on objects being compared; missing conformance will not trigger diffs.
  • Integration with XCTest requires custom assertion function override in test target; not automatically wired into standard assertions.
  • Reflection-based implementation may not handle circular references gracefully; test with complex nested structures before relying on it.
  • Platform coverage spans iOS, macOS, tvOS, watchOS; verify Swift version compatibility for older deployment targets.
  • lldb integration via `dumpDiff()` command is optional; most usage through direct `diff()` function calls in test code.

When to avoid it — and what to weigh

  • Non-Swift Projects — Language-specific to Swift; not applicable for Kotlin, Java, or other runtime ecosystems.
  • Non-Equatable Types — Requires types to conform to Equatable protocol; cannot diff objects without equality implementation.
  • Performance-Critical Diff Operations — Reflection-based approach may incur overhead in large-scale property comparisons; unsuitable for high-frequency runtime diffing in production code.
  • Snapshot or Visual Testing — Focused on structural property diffing; does not provide visual diff capabilities for UI or image comparisons.

License & commercial use

MIT License (MIT). Permissive open-source license allowing commercial use, modification, and distribution with attribution.

MIT is a permissive OSI license. Commercial use in proprietary test suites and applications is permitted, provided the MIT license and copyright notice are retained in any source distribution. No attribution required in compiled binaries or closed-source applications, but review your legal policy for source-level inclusion.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

No security model relevant to a testing utility. Reflection-based implementation inspects object state at runtime in test/debug contexts only; does not process untrusted input. Standard code review recommended before modifying test assertions.

Alternatives to consider

AssertEqual (Custom Implementation)

Write custom assertion helpers tailored to specific model structures; more control but higher maintenance overhead.

Nimble Matchers

Broader BDD matching framework; provides richer assertion vocabulary but less specialized for property-level diffs.

Quick + Custom Matcher

Build domain-specific matchers for custom types; more flexible but requires additional boilerplate per project.

Software development agency

Build on Difference with DEV.co software developers

Add property-level diffs to your TDD workflow. Install via CocoaPods, SPM, or Carthage and override your test assertions for clearer failures.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

Difference FAQ

Does Difference work with non-Equatable types?
No. The library requires types to explicitly conform to Equatable protocol. Non-Equatable types will not produce diffs.
Can I use Difference in production code?
Difference is designed for testing and debugging contexts (test targets, lldb). Using it in production code is not recommended due to reflection overhead and testing-focused API.
Is the custom XCTAssertEqual override mandatory?
No. You can call `diff()` directly in your test assertions or use lldb `dumpDiff()` command. The custom assertion override is optional convenience.
How does Difference handle nested objects?
Reflection-based traversal inspects nested Equatable properties recursively. Indentation and formatting (pipe style) is configurable. Circular references behavior is not documented; test with your structures.

Software developers & web developers for hire

Our engineers ship open-source testing software for a living. DEV.co provides software development services, web development services, and ongoing support for teams standardizing on tools like Difference.

Integrate Difference into your Swift test suite

Add property-level diffs to your TDD workflow. Install via CocoaPods, SPM, or Carthage and override your test assertions for clearer failures.