A modern Swift testing library

Catch changes your assertions cannot see.

SnapshotTesting compares a value with a stored reference. Test UIKit and SwiftUI screens, JSON, requests, dumps, and the formats that matter to your project.

Get started

Browse examples

Latest stable release

2.2.0

Published August 16, 2026

Swift Package Manager: .upToNextMajor(from: "2.2.0")

Release notes

One assertion, a useful result

Start with the test you already wanted to write.

The first run records a missing reference and tells you where it went. Later runs compare against that file and point to the difference when the value changes.

ProfileTests.swift

import SnapshotTesting
import Testing

@MainActor
struct ProfileTests {
  @Test func profileCard() {
    assertSnapshot(of: ProfileCard(), as: .image)
  }
}

Reference = Current: a reference snapshot matching the current rendering.

References that stay readable

See the change. Keep the proof.

Snapshot files live beside tests by default. They are ordinary files, easy to review in a pull request and simple to update when a visual change is intentional.

What it tests

Images — Render UIKit and SwiftUI views at the devices and traits you choose.

Text formats — Compare JSON, property lists, raw requests, and recursive descriptions.

SwiftUI previews — Reuse preview definitions in tests with SnapshotPreviews.

Your own values — Write a snapshot strategy for data that has a stable representation.

Built for current Swift

Swift 6.3, Apple platforms, Linux, and Android.

Image rendering uses native platform frameworks. Text and data snapshots work wherever Swift does.

Read the documentation

A maintained fork

Built on Point-Free’s original SnapshotTesting.

This project continues the library created by Point-Free, with Swift 6 support and active maintenance by Modern Swift Development.

Snapshot testing for Swift projects. Maintained by Modern Swift Development.