RepoPilotOpen in app β†’

pointfreeco/swift-snapshot-testing

πŸ“Έ Delightful Swift snapshot testing.

Healthy

Healthy across the board

Use as dependencyHealthy

Permissive license, no critical CVEs, actively maintained β€” safe to depend on.

Fork & modifyHealthy

Has a license, tests, and CI β€” clean foundation to fork and modify.

Learn fromHealthy

Documented and popular β€” useful reference codebase to read through.

Deploy as-isHealthy

No critical CVEs, sane security posture β€” runnable as-is.

  • βœ“Last commit 6w ago
  • βœ“29+ active contributors
  • βœ“Distributed ownership (top contributor 47% of recent commits)
Show 3 more β†’
  • βœ“MIT licensed
  • βœ“CI configured
  • βœ“Tests present

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Healthy" badge

Paste into your README β€” live-updates from the latest cached analysis.

Variant:
RepoPilot: Healthy
[![RepoPilot: Healthy](https://repopilot.app/api/badge/pointfreeco/swift-snapshot-testing)](https://repopilot.app/r/pointfreeco/swift-snapshot-testing)

Paste at the top of your README.md β€” renders inline like a shields.io badge.

β–ΈPreview social card (1200Γ—630)

This card auto-renders when someone shares https://repopilot.app/r/pointfreeco/swift-snapshot-testing on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: pointfreeco/swift-snapshot-testing

Generated by RepoPilot Β· 2026-05-10 Β· Source

πŸ€–Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale β€” STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI Β· unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/pointfreeco/swift-snapshot-testing shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything β€” but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

GO β€” Healthy across the board

  • Last commit 6w ago
  • 29+ active contributors
  • Distributed ownership (top contributor 47% of recent commits)
  • MIT licensed
  • CI configured
  • Tests present

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

βœ…Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live pointfreeco/swift-snapshot-testing repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale β€” regenerate it at repopilot.app/r/pointfreeco/swift-snapshot-testing.

What it runs against: a local clone of pointfreeco/swift-snapshot-testing β€” the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in pointfreeco/swift-snapshot-testing | Confirms the artifact applies here, not a fork | | 2 | License is still MIT | Catches relicense before you depend on it | | 3 | Default branch main exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≀ 70 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> β€” paste this script from inside your clone of <code>pointfreeco/swift-snapshot-testing</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of pointfreeco/swift-snapshot-testing. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/pointfreeco/swift-snapshot-testing.git
#   cd swift-snapshot-testing
#
# Then paste this script. Every check is read-only β€” no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of pointfreeco/swift-snapshot-testing and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "pointfreeco/swift-snapshot-testing(\\.git)?\\b" \\
  && ok "origin remote is pointfreeco/swift-snapshot-testing" \\
  || miss "origin remote is not pointfreeco/swift-snapshot-testing (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(MIT)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"MIT\"" package.json 2>/dev/null) \\
  && ok "license is MIT" \\
  || miss "license drift β€” was MIT at generation time"

# 3. Default branch
git rev-parse --verify main >/dev/null 2>&1 \\
  && ok "default branch main exists" \\
  || miss "default branch main no longer exists"

# 4. Critical files exist
test -f "Sources/SnapshotTesting/AssertSnapshot.swift" \\
  && ok "Sources/SnapshotTesting/AssertSnapshot.swift" \\
  || miss "missing critical file: Sources/SnapshotTesting/AssertSnapshot.swift"
test -f "Sources/SnapshotTesting/Snapshotting.swift" \\
  && ok "Sources/SnapshotTesting/Snapshotting.swift" \\
  || miss "missing critical file: Sources/SnapshotTesting/Snapshotting.swift"
test -f "Sources/SnapshotTesting/Diffing.swift" \\
  && ok "Sources/SnapshotTesting/Diffing.swift" \\
  || miss "missing critical file: Sources/SnapshotTesting/Diffing.swift"
test -f "Sources/SnapshotTesting/Snapshotting/UIImage.swift" \\
  && ok "Sources/SnapshotTesting/Snapshotting/UIImage.swift" \\
  || miss "missing critical file: Sources/SnapshotTesting/Snapshotting/UIImage.swift"
test -f "Sources/SnapshotTesting/Snapshotting/SwiftUIView.swift" \\
  && ok "Sources/SnapshotTesting/Snapshotting/SwiftUIView.swift" \\
  || miss "missing critical file: Sources/SnapshotTesting/Snapshotting/SwiftUIView.swift"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 70 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~40d)"
else
  miss "last commit was $days_since_last days ago β€” artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) β€” safe to trust"
else
  echo "artifact has $fail stale claim(s) β€” regenerate at https://repopilot.app/r/pointfreeco/swift-snapshot-testing"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

⚑TL;DR

swift-snapshot-testing is a Swift library that captures and compares snapshots of any value (views, view controllers, strings, data structures) during testing, automatically detecting regressions when output changes. It goes beyond image snapshots by supporting multiple serialization strategies (.image, .description, .plist, etc.) across iOS, macOS, tvOS, and watchOS, with zero configuration required. Dual-package structure: Sources/SnapshotTesting/ is the core library (AssertSnapshot.swift, Diffing.swift, Diff.swift) with strategies for rendering, while Sources/InlineSnapshotTesting/ is a newer module (AssertInlineSnapshot.swift) for inline snapshot recording. Common/ houses platform abstractions (View.swift, XCTAttachment.swift, PlistEncoder.swift), and Documentation.docc/ contains DoCC-formatted articles including CustomStrategies.md and migration guides.

πŸ‘₯Who it's for

iOS/macOS engineers writing unit and integration tests who need to validate UI rendering and complex data transformations without manually writing brittle assertions; particularly developers using Swift Testing or XCTest who want low-friction regression detection.

🌱Maturity & risk

Production-ready and actively maintained by Point-Free Co. The repo shows comprehensive CI/CD (GitHub Actions workflows in .github/workflows/), extensive DoCC documentation in Sources/SnapshotTesting/Documentation.docc/, migration guides for breaking changes (MigratingTo1.19.md), and modern Swift 5.9+ support (Package@swift-5.9.swift). Regular releases and active issue response indicate healthy maintenance.

Low risk overall: no external runtime dependencies visible (Swift stdlib only in Package.swift), owned by established Point-Free brand, and includes formal deprecation guides. Main risk is single-organization maintenance, but the library's breadth of platform support (iOS, macOS, tvOS, watchOS) and multiple serialization strategies mean breaking changes are managed carefully. No indicators of abandonment.

Active areas of work

Active development on inline snapshot testing (InlineSnapshotTesting module), recent migration guides indicate v1.19 release addressing API changes, and CI pipeline (ci.yml, format.yml, release.yml) running regularly. The presence of both .github/kaleidoscope-diff.png and custom diff tooling (Diff.swift) suggests ongoing work on diff presentation UX.

πŸš€Get running

git clone https://github.com/pointfreeco/swift-snapshot-testing.git && cd swift-snapshot-testing && swift build

Daily commands: make test (from Makefile) runs the test suite; make format runs code formatting. Or use swift test directly, or open Package.swift in Xcode and Cmd+U.

πŸ—ΊοΈMap of the codebase

  • Sources/SnapshotTesting/AssertSnapshot.swift β€” Core entry point that implements the primary assertSnapshot function used in all snapshot tests.
  • Sources/SnapshotTesting/Snapshotting.swift β€” Defines the Snapshotting protocol that abstracts how different types are serialized for snapshot comparison.
  • Sources/SnapshotTesting/Diffing.swift β€” Implements the diffing logic that compares snapshots and generates human-readable diffs for test failures.
  • Sources/SnapshotTesting/Snapshotting/UIImage.swift β€” Provides image snapshotting strategy, the most commonly used snapshot format for UI testing.
  • Sources/SnapshotTesting/Snapshotting/SwiftUIView.swift β€” Implements SwiftUI-specific snapshotting to capture view hierarchies and layouts.
  • Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift β€” Enables inline snapshot testing where expected values are stored directly in test code rather than separate files.
  • Package.swift β€” SPM manifest defining library structure, platforms, and dependencies for the entire package.

πŸ› οΈHow to make changes

Add a new snapshot strategy for a custom type

  1. Create a new file in Sources/SnapshotTesting/Snapshotting/ named after your type (e.g., MyCustomType.swift) (Sources/SnapshotTesting/Snapshotting/UIImage.swift)
  2. Extend Snapshotting with a static property that returns Snapshotting<YourType, SnapshotFormat>. Implement the pull(from:) method to extract the representation and the diffing strategy. (Sources/SnapshotTesting/Snapshotting.swift)
  3. Define how your type serializes (e.g., to Data, String, or image) using a Snapshotting conformance. (Sources/SnapshotTesting/Diffing.swift)
  4. Add tests in Tests/SnapshotTestingTests/ that verify the strategy works with assertSnapshot(of:as:) calls. (Tests/SnapshotTestingTests/SnapshotTestingTests.swift)

Add support for a new UI framework or platform

  1. Create a new platform-specific file in Sources/SnapshotTesting/Snapshotting/ (e.g., WKWebView.swift for WebKit). (Sources/SnapshotTesting/Snapshotting/UIView.swift)
  2. Extend Snapshotting with an image() or custom format strategy that renders your framework's component to Data or Image. (Sources/SnapshotTesting/Snapshotting/SwiftUIView.swift)
  3. Update Sources/SnapshotTesting/Common/View.swift if cross-platform abstraction is needed. (Sources/SnapshotTesting/Common/View.swift)
  4. Add tests demonstrating the new framework's snapshot capture and comparison. (Tests/SnapshotTestingTests/SnapshotTestingTests.swift)

Add a new snapshot format (e.g., custom serialization)

  1. Define a new type conforming to Codable or basic serialization logic. (Sources/SnapshotTesting/Snapshotting.swift)
  2. Create a Snapshotting extension that provides the format strategy, specifying the snapshot format type and diffing method. (Sources/SnapshotTesting/Snapshotting/String.swift)
  3. Implement or reuse a diffing strategy in Sources/SnapshotTesting/Diffing.swift for comparing snapshots in your format. (Sources/SnapshotTesting/Diffing.swift)
  4. Write tests that use assertSnapshot(of:as:) with your new format. (Tests/SnapshotTestingTests/SnapshotTestingTests.swift)

Integrate inline snapshots into an existing test

  1. Import InlineSnapshotTesting in your test file. (Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift)
  2. Replace assertSnapshot calls with assertInlineSnapshot, passing the expected value as the second argument. (Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift)
  3. Enable recording mode (via SnapshotTestingConfiguration or command-line flag) to auto-populate inline expected values. (Sources/SnapshotTesting/SnapshotTestingConfiguration.swift)
  4. Run tests to auto-update inline snapshot values; verify diffs and commit changes. (Tests/InlineSnapshotTestingTests/InlineSnapshotTestingTests.swift)

πŸ”§Why these technologies

  • Swift Package Manager (SPM) β€” Native Swift build system, simplifies dependency management and cross-platform distribution.
  • XCTest + Swift Testing β€” Integrates with Xcode's test infrastructure and the new Swift Testing framework for native test reporting.
  • CustomDump for value snapshots β€” Provides structured,

πŸͺ€Traps & gotchas

No required environment variables or external services, but tests generating snapshots will create Snapshots/ directories in test bundleβ€”ensure test targets have write permissions. The library detects test context via XCTest/Testing frameworks, so it must be imported in test targets, not main bundles. Inline snapshots (InlineSnapshotTesting) requires source file mutation on record, which may interact unexpectedly with some test runners or CI cache strategies. Image snapshots use platform-specific rendering (UIGraphicsImageRenderer on iOS, NSGraphicsContext on macOS), so cross-platform consistency requires identical layouts.

πŸ—οΈArchitecture

πŸ’‘Concepts to learn

  • Snapshot Testing / Approval Testing β€” Core concept of this libraryβ€”understanding the write-once-compare-many paradigm is essential to using assertSnapshot() effectively and avoiding snapshot pollution
  • Strategy Pattern (Snapshotting Protocol) β€” The Diffing.swift Snapshotting<Value, Format> protocol is the library's extension point; learning how strategies compose formats (image, description, plist) with comparison logic is key to custom implementations
  • Async/Await Integration (Async.swift) β€” Modern Swift concurrency support means assertSnapshot works with async view lifecycle methods and task groups; essential for testing async UI state changes
  • Diff Algorithms (Diff.swift) β€” The library uses efficient diff computation to generate readable failure messages; understanding line-based or pixel-level diffing strategies helps interpret snapshot mismatches
  • Platform Abstraction Layers (View.swift) β€” Rendering snapshots across UIKit (iOS), AppKit (macOS), WatchKit, and SwiftUI requires conditional compilation and runtime type switching; View.swift demonstrates this pattern
  • In-Source Snapshots (InlineSnapshotTesting Module) β€” Newer pattern where expected snapshot values live inline in test code rather than separate Snapshots/ files; requires source mutation and AST manipulation during test recording
  • XCTest Attachments API (XCTAttachment.swift) β€” Integration with Xcode's test report navigator and failure details; understanding how snapshot diffs are surfaced as attachments improves debugging workflows
  • pointfreeco/swift-composable-architecture β€” Companion library from same maintainer; TCA tests often use snapshot testing for reducer output and UI validation
  • ashleymills/Reachability.swift β€” Not directly related, but snapshot testing of network state transitions is common; listed as reference for multi-platform Swift patterns
  • uber/ios-snapshot-test-case β€” Alternative Objective-C snapshot testing library; swift-snapshot-testing is the modern Swift-native successor with broader strategy support
  • pointfreeco/swift-perception β€” Dependency awareness library; used in tests to ensure snapshot consistency across observable state changes
  • apple/swift-testing β€” New Swift native testing framework; swift-snapshot-testing has first-class integration via @Suite(.snapshots(record:)) syntax

πŸͺ„PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive snapshot strategy tests for UIView/NSView on macOS

The repo has Snapshotting strategies for NSView and NSViewController but no dedicated test file for macOS view snapshotting. Given that Sources/SnapshotTesting/Snapshotting/NSView.swift and NSViewController.swift exist, there should be parallel test coverage for these macOS-specific strategies similar to what likely exists for iOS views. This is critical for ensuring snapshot accuracy across Apple platforms.

  • [ ] Create Tests/SnapshotTestingTests/Snapshotting/NSViewSnapshotTests.swift
  • [ ] Add test cases for NSView snapshotting with various configurations (size, layer rendering, etc.)
  • [ ] Add test cases for NSViewController snapshotting
  • [ ] Ensure macOS-specific rendering edge cases are covered (Retina displays, color spaces)
  • [ ] Run tests on macOS CI to validate

Add snapshot strategy tests for SceneKit and SpriteKit

The codebase includes Sources/SnapshotTesting/Snapshotting/SceneKit.swift and SpriteKit.swift, but there are no visible test files for these game/3D rendering frameworks. These are specialized snapshot strategies that need validation to ensure 3D scene and sprite rendering are correctly captured across different configurations.

  • [ ] Create Tests/SnapshotTestingTests/Snapshotting/SceneKitSnapshotTests.swift with tests for SCNView snapshotting
  • [ ] Create Tests/SnapshotTestingTests/Snapshotting/SpriteKitSnapshotTests.swift with tests for SKView snapshotting
  • [ ] Test rendering of basic scenes (geometry, materials, lighting for SceneKit; sprites and physics for SpriteKit)
  • [ ] Validate deterministic snapshot output across test runs

Implement integration tests for custom Snapshotting strategies in documentation examples

Sources/SnapshotTesting/Documentation.docc/Articles/CustomStrategies.md documents how to create custom strategies, but there are no runnable test examples demonstrating custom strategy implementation. Adding comprehensive test cases that mirror the documentation would ensure the guidance is accurate and reduce user friction when implementing their own strategies.

  • [ ] Create Tests/SnapshotTestingTests/Documentation/CustomStrategiesExampleTests.swift
  • [ ] Implement 2-3 concrete custom strategy examples from the CustomStrategies.md article as actual testable code
  • [ ] Add tests validating custom strategies work with assertSnapshot and inline snapshot testing
  • [ ] Ensure examples cover edge cases like async transformations and format specification
  • [ ] Cross-reference examples back to the documentation article

🌿Good first issues

  • Add snapshot strategy documentation examples in Sources/SnapshotTesting/Documentation.docc/Extensions/Snapshotting.md for common formats (JSON, XML, CSV) beyond the existing CustomStrategies.md article
  • Expand Sources/SnapshotTesting/Common/PlistEncoder.swift test coverageβ€”currently no dedicated test file visible; add round-trip serialization tests
  • Create a migration guide for TestFrameworks integration similar to Sources/SnapshotTesting/Documentation.docc/Articles/IntegratingWithTestFrameworks.md but specifically for Swift Testing's new @Test macro and async test support

⭐Top contributors

Click to expand

πŸ“Recent commits

Click to expand
  • ad5e319 β€” Bump swift-syntax to latest (#1074) (dfed)
  • e819244 β€” Fix formatting of bitmapInfo initialization (stephencelis)
  • 05b6f05 β€” Prefer native Swift Testing image attachments on supported toolchains (#1067) (ajkolean)
  • 8ad49bf β€” Fix UIImage diff attachments under Swift Testing (#1066) (ajkolean)
  • d798bc4 β€” Record attachment when recording new snapshots. (#1065) (mbrandonw)
  • 0ce5359 β€” Update AssertSnapshot.swift (#997) (Kyle-Ye)
  • af9607f β€” Support Swift Testing attachments. (#1064) (mbrandonw)
  • cfa6cc9 β€” Improvements to the generated difference image (#1028) (CraigSiemens)
  • 6bb6c9a β€” Introduce API accepting record: Record?, deprecating Bool? (#1057) (pyrtsa)
  • bf8d8c2 β€” Leverage atexit instead of test observers (#1050) (stephencelis)

πŸ”’Security observations

This is a well-maintained Swift snapshot testing library with a strong security posture. No critical or high-severity vulnerabilities were identified in the static analysis. The codebase follows best practices for open-source Swift development with proper GitHub workflows, CI/CD configuration, and documentation. Minor observations are noted below for completeness.

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals β€” see the live page for receipts. Re-run on a new commit to refresh.

Healthy signals Β· pointfreeco/swift-snapshot-testing β€” RepoPilot