6.3AI agents can now see your previews

Your previews are already tests.

Prefire turns every #Preview into a snapshot test, a Playbook screen and an image your AI agent can look at.

Trip screen, light mode, rendered by Prefire
Trip screen, dark mode, rendered by Prefire
Trip screen in the delayed state, light mode, rendered by Prefire
Rendered by prefire render .previewState(.default)
Works withXcodeSwift Package ManagerClaude CodeCursorCodex

Write previews. Get the rest for free.

You already describe every state of a screen in #Preview. Prefire reuses them, so there is nothing extra to write or keep in sync.

#Preview("Trip") {
    TripView(status: .onTime)
        .previewUserStory(.trip)
}

#Preview("Trip delayed") {
    TripView(status: .delayed(minutes: 45, departure: "10:25"))
        .previewUserStory(.trip)
        .previewState(.delayed)
}

Snapshot tests, generated

The build plugin writes a test for each preview and compares it with the reference image on the devices you pick. A moved pixel fails CI, not the release.

Playbook catalog of components and user stories

Playbook

A catalog of every component and user story, inside your app.

Trip, on time
default
Trip, delayed
delayed
Trip, loading
loading

Every state

Mark states with .previewState() and group screens into flows with .previewUserStory().

lightdark
Trip, dark mode
Trip, light mode

Any device, light or dark

Render on any iPhone or iPad with its real safe area, in either color scheme and any Dynamic Type size.

Let your agent see SwiftUI. Not guess it.

An agent that edits a view can't see the result. Prefire builds the app and returns the previews as images, right in the conversation.

One command to connect

claude mcp add prefire -- prefire mcp

Or the plugin with a skill: /plugin marketplace add BarredEwe/Prefire

  • list_previewsPreviews with file and line
  • render_previewsPNGs for the devices and scheme asked for
  • build_boardHTML board of the last render
render_previews(
  previews: ["Trip", "Trip delayed", "Trip loading"],
  devices: ["iPhone 16 Pro"],
  color_scheme: "dark"
)
Trip, dark
Trip delayed, dark
Trip loading, dark
~/Example
$ prefire render "Trip" "Trip delayed" "Trip loading" --device "iPhone 16 Pro" --color-scheme dark
✅ Trip-iPhone 16 Pro (iPhone 16 Pro): .prefire/render/Trip-iPhone_16_Pro.png
✅ Trip delayed-iPhone 16 Pro (iPhone 16 Pro): .prefire/render/Trip_delayed-iPhone_16_Pro.png
✅ Trip loading-iPhone 16 Pro (iPhone 16 Pro): .prefire/render/Trip_loading-iPhone_16_Pro.png
Manifest: .prefire/render/manifest.json

The same from the terminal or CI

prefire render writes PNGs with a JSON record for each preview. prefire board lays the last render out as an HTML flow board.

Set up in a minute. Pick one.

Swift Package Manager

Add the plugin to your snapshot test target.

.package(
  url: "https://github.com/BarredEwe/Prefire.git",
  from: "6.4.0"
)
.plugin(name: "PrefireTestsPlugin", package: "Prefire")

Xcode

Add the package, then the plugins in Build Phases.

// test target
PrefireTestsPlugin
// app target
PrefirePlaybookPlugin

Homebrew

The CLI for tests, render and the MCP server.

brew install barredewe/prefire/prefire

Swift 6, Xcode 16, iOS 14+, macOS 13+. Snapshot tests on iOS, tvOS and macOS. Configuration

Start with the previews you have.

Free and open source under Apache 2.0.