DEV.co
Open-Source Testing · pointfreeco

swift-custom-dump

swift-custom-dump is a Swift debugging and testing utility that provides improved output formatting for data structures compared to Swift's built-in dump function. It includes diff capabilities and assertion helpers for test writing.

Source: GitHub — github.com/pointfreeco/swift-custom-dump
882
GitHub stars
110
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
Repositorypointfreeco/swift-custom-dump
Ownerpointfreeco
Primary languageSwift
LicenseMIT — OSI-approved
Stars882
Forks110
Open issues11
Latest release1.6.1 (2026-06-19)
Last updated2026-07-03
Sourcehttps://github.com/pointfreeco/swift-custom-dump

What swift-custom-dump is

A Swift Package Manager library offering customDump() for readable structure inspection, diff() for textual comparison, and expectNoDifference/expectDifference assertion helpers. Supports customization via CustomDumpStringConvertible, CustomDumpReflectable, and CustomDumpRepresentable protocols.

Quickstart

Get the swift-custom-dump source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/pointfreeco/swift-custom-dump.gitcd swift-custom-dump# follow the project's README for install & configuration

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

Best use cases

Test Assertion and Failure Diagnostics

Use expectNoDifference and expectDifference to replace XCTAssertEqual with more readable diff output in test failures, particularly for complex nested structures.

Debug Output in Development

Replace default dump() calls with customDump() to get cleaner, more readable console output of application state during development and debugging.

State Transition Validation

Apply diff() to compare before/after states in feature workflows or mutation operations, useful for snapshot testing and behavioral verification.

Implementation considerations

  • Integrate into test targets via SPM with `swift-custom-dump` dependency; no changes needed to production target code.
  • Customize output for domain types by conforming to CustomDumpStringConvertible, CustomDumpReflectable, or CustomDumpRepresentable as needed.
  • Replace existing XCTAssertEqual and #expect(_ == _) calls with expectNoDifference where detailed diff output aids test readability.
  • Review expected behavior when comparing types with Objective-C imports; README notes limited output for some ObjC-bridged enums.
  • Verify Swift version and platform compatibility via SwiftPackageIndex badges; ensure your minimum deployment target is supported.

When to avoid it — and what to weigh

  • Non-Swift or Polyglot Environments — This is a Swift-only library; it provides no value in Objective-C, Java, Kotlin, or multi-language codebases.
  • Production Runtime Performance Requirements — customDump and diff are reflection-heavy and suitable for debug/test code, not for performance-critical production paths.
  • Snapshot Testing as Primary Need — If you need comprehensive snapshot testing infrastructure, consider dedicated tools like SnapshotTesting or Pointfree's own snapshot frameworks.
  • CI/CD Binary Size Constraints — If binary bloat is a concern, verify the footprint added by this library and its reflection dependencies in your distribution.

License & commercial use

Licensed under the MIT License, which is a permissive OSI-approved license.

MIT License permits commercial use, modification, and distribution with attribution. No commercial restrictions or licensing fees apply. Verify your own legal review for compliance in commercial contexts.

DEV.co evaluation signals

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

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

Security implications are minimal for test/debug-only usage. Reflection-based introspection does not expose sensitive data beyond what is already present in memory during testing. No network, file I/O, or external service integration. Ensure customDump output is not logged to production or public-facing surfaces.

Alternatives to consider

Swift's Built-in dump()

Free and always available, but produces verbose and hard-to-read output for nested structures and dictionaries; less suitable for test assertions.

Pointfree SnapshotTesting

Broader snapshot and regression testing framework; heavier-weight but supports file-based snapshots and multi-format comparisons if that is the primary need.

XCTest XCTAssertEqual with String Diffing (custom)

Manual diff implementation or third-party XCTest extensions; requires more boilerplate but avoids external dependency if minimalism is paramount.

Software development agency

Build on swift-custom-dump with DEV.co software developers

Add swift-custom-dump to your test suite today for clearer assertion failures and better debugging. Lightweight, MIT-licensed, and actively maintained.

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.

swift-custom-dump FAQ

Can I use custom-dump in production code?
Not recommended. It is designed for test and debug code. Reflection-heavy operations are unsuitable for performance-critical paths. Keep it in test targets only.
Does it work with Equatable types?
Yes. It does not require Equatable conformance but works well with it. For types not Equatable, customDump and diff still function via reflection.
How do I customize the dump output for my own types?
Conform your type to CustomDumpStringConvertible, CustomDumpReflectable, or CustomDumpRepresentable. See the README Customization section for details.
Is it compatible with Swift Testing and XCTest?
Yes. expectNoDifference and expectDifference work with both XCTest (via XCTestDynamicOverlay) and Swift Testing.

Work with a software development agency

DEV.co helps companies turn open-source tools like swift-custom-dump into production software. Our software development services cover the full lifecycle — architecture, web development, integration, and maintenance — delivered by software developers and web developers who ship. Engage our software development agency to implement or customize it for your open-source testing stack.

Ready to improve your Swift testing?

Add swift-custom-dump to your test suite today for clearer assertion failures and better debugging. Lightweight, MIT-licensed, and actively maintained.