Skip to content
Back to skills

Swiftui Preview

ASecurity

Look at SwiftUI views as images with Prefire. Use after changing a SwiftUI view, to check its layout on iPhone or iPad, in dark mode or with large Dynamic Type, or when the user asks how a screen looks. Renders #Preview blocks to PNG through the prefire MCP server (list_previews, render_previews, build_board) or the `prefire render` CLI, without Xcode Previews.

  • 535 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 13, 2026
developmentgoswiftshellgitdocumentation

Works with

  • cli
  • mcp

Security analysis

A100/100

Scanned November 13, 2026

npx -y skills add BarredEwe/Prefire --skill swiftui-preview --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Swiftui Preview?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Swiftui Preview
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/barredewe-swiftui-preview/badge)](https://www.skillsdirectory.com/skills/barredewe-swiftui-preview)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: swiftui-preview
description: Look at SwiftUI views as images with Prefire. Use after changing a SwiftUI view, to check its layout on iPhone or iPad, in dark mode or with large Dynamic Type, or when the user asks how a screen looks. Renders #Preview blocks to PNG through the prefire MCP server (list_previews, render_previews, build_board) or the `prefire render` CLI, without Xcode Previews.
---

# Seeing SwiftUI with Prefire

Prefire builds the app and runs its generated snapshot tests in render mode, so every `#Preview`
comes back as a PNG of the current code. Use it to check your own UI changes instead of guessing.

## Loop

1. Call `list_previews` once to learn the preview names and where each is declared.
2. Change the view.
3. Call `render_previews` with only the previews you touched, for example
   `{"previews": ["Sign in"], "devices": ["iPhone 16 Pro"], "color_scheme": "dark"}`.
   A render builds the project, so it takes as long as a test run: ask for few previews.
4. Look at the images. Fix what is off and render again. Say what you checked.

Before calling a UI change done, render it at least once. For layout changes, also check a small
phone (`iPhone SE (3rd generation)`), an `iPad`, `dark`, and `accessibility3` Dynamic Type.

## Reading the result

- The first content block is JSON: each preview with `image` path, size, `device`, `source`
  (`file:line`), `userStory`, `state` and `error`. `notes` lists names that matched nothing and
  devices that were ignored.
- Images beyond `max_images` (default 6) are not attached; read them from their paths.
- `isError: true` with "no snapshot test ran in render mode" means the tests are not set up or
  were generated by an older Prefire: see Setup.
- "xcodebuild exited with 65" means the build or a test failed. Read `xcodebuild.log` in the
  output directory, fix the build, and render again. The last good render is kept.
- An unknown device gets a record with the error and the device names Prefire knows.

## Setup, when the tools are missing or fail

- Install the CLI: `brew install barredewe/prefire/prefire`.
- The project needs Prefire's snapshot tests: the `Prefire` package with `PrefireTestsPlugin` on a
  test target. See https://github.com/BarredEwe/Prefire#-quick-start.
- `.prefire.yml` in the project folder needs a `render_configuration`:

  ```yaml
  render_configuration:
    scheme: MyApp                      # scheme whose tests include the snapshot tests
    project: MyApp.xcodeproj           # or workspace: MyApp.xcworkspace
    destination: platform=iOS Simulator,name=iPhone 16   # platform=macOS for a Mac app
    test_target: MyAppSnapshotTests    # runs only the tests of the previews asked for
  ```

- Without the MCP server, the same works from a shell: `prefire render "Sign in" --device iPad`,
  `prefire render --list`, `prefire board`.

Full guide: https://github.com/BarredEwe/Prefire/blob/main/Documentation/AI.md

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.