SwiftUI Preview

ClaudeSwiftUI

Faster SwiftUI development in Claude Code: see Xcode previews without a simulator run.

The Problem

When Claude Code changes a SwiftUI screen, you want to see what it actually looks like. You can switch to Xcode and wait for its preview canvas, or build and launch the app in the simulator, navigate to the screen, and check the result.

Claude often takes the simulator route too, building and launching the entire app just to see one screen. And if something looks wrong, you make another change and repeat the process.

It's a lot of back and forth when all you want to do is see the UI you're working on and move fast.

The Solution

SwiftUI Preview brings Xcode's previews directly into your Claude Code conversation.

Type /preview, tell Claude which SwiftUI screen and device you want to see, and Xcode renders it without launching the app in the simulator. The result appears in a pane beside your conversation in the Claude desktop app, inside an Apple device frame.

Claude sees the preview too. It can inspect what it built, describe the result, and help you make adjustments. You can check each change together, try different devices and appearances, and keep working without leaving your conversation.

Features

  • See what Claude is building. Preview any SwiftUI screen directly beside your conversation. Claude can create a #Preview if the screen doesn't have one, so you don't have to set it up yourself.
  • Make changes and see the results. Claude looks at each rendered preview before responding. If something doesn't look right, ask it to make adjustments and render the screen again. You can work through the UI together instead of relying on code changes alone.
  • Skip unnecessary simulator runs. For visual checks, Xcode renders the SwiftUI preview without launching the entire app. When Claude starts a simulator run, the plugin can suggest using a preview instead. You can still use the simulator for interactions, navigation, and testing with real data.
  • Check different devices and layouts. Choose any iPhone or iPad simulator model available in Xcode, or preview on a Mac. You can also check the iPhone Duo folded or unfolded, including its different screens and orientations.
  • Check accessibility and appearance. See how your UI looks in dark mode, with increased contrast, at larger Dynamic Type sizes, or in different orientations. Choose from the variants Xcode makes available for the preview and render the screen again.
  • See your screens inside Apple's device frames. Supported devices use Apple's product bezels, so you can see your SwiftUI screens in the context of the actual device. You can also preview without bezels.
  • Keep and export your previews. Go back through earlier renders in your conversation, open them in macOS Preview, or export an image to a folder of your choice.
  • Turn it off whenever you want. Use /preview off to disable the tool for the current session and /preview on to enable it again.

Sample Prompts

See what Claude built

  • /preview ContentView on an iPhone 18 Pro
  • Show me what the app looks like right now on the Mac.

Check different devices

  • Show me this screen on the iPhone Duo when it's closed.
  • Now show it on the open phone in landscape.

Check accessibility and appearance

  • Show me this screen at the largest accessibility text size.
  • Preview it in dark mode with increased contrast.

Make improvements

  • The text looks cramped on the smaller screen. Fix the layout and show me the updated preview.

How it works

SwiftUI Preview has three parts:

  1. The Claude Code plugin adds the /preview command and a tool for rendering SwiftUI previews. Claude figures out which file, #Preview, and device you want from your request. If a screen doesn't have a #Preview, Claude creates one. If something isn't clear, it asks you.
  1. Xcode renders your SwiftUI screen through its built-in MCP tools, using the simulator device or Mac you selected. It doesn't need to launch your app in the simulator.
  1. The `bezel` command puts the rendered screen inside an Apple device frame, when available. The plugin then displays the image beside your conversation in the Claude desktop app, where both you and Claude can see it.

You build the Swift bezel command once during installation. After that, you can use /preview directly in your Claude Code sessions.

FAQs

Can I use it with Codex?

SwiftUI Preview was built specifically for Claude Code's mod hooks, with previews displayed in the Code tab of the Claude desktop app. It doesn't currently support Codex.

Does this replace running my app in the simulator?

No. SwiftUI Preview is for checking how individual screens look. It's useful for reviewing layouts, making visual adjustments, and testing different appearances without launching the app.

You'll still want the simulator to test interactions, navigation between screens, and behavior that depends on running the app with real data.

What if my SwiftUI view doesn't have a #Preview?

Claude can add one for you. You can also point it to an existing preview or ask it to show a particular screen.

Do I need Apple's device bezels?

No. The tool can render screens without device frames.

If you want the frames, you can download them for free from Apple Design Resources. The four sets total approximately 550 MB. They're Apple's artwork, so they aren't included in your purchase.

Which devices are supported?

You can render previews for any iPhone or iPad simulator model available in your Xcode installation, or for a Mac.

The tool includes support for Apple device frames for the iPhone 18 Pro, iPhone 18 Pro Max, iPhone Duo, iPad Air, and MacBook Air. Other models use a frame from the same device category. For example, an iPad Pro preview can appear inside an iPad Air frame.

Note that you can add support for more devices by downloading their bezels from Apple and asking your agent to extend the tool.

Can I preview different appearances and accessibility settings?

Yes. The preview pane shows the variants that Xcode makes available, including color scheme, contrast, Dynamic Type size, and orientation. Select a variant to render the screen again with that setting.

How long does a preview take to render?

It depends on your project and whether Xcode has already prepared the preview. The first render can take considerably longer.

In testing, the first render was still running after 52 seconds. Subsequent renders took approximately 2–30 seconds. Your results may vary.

What happens after you buy

  1. 1

    Download

    Click the download link to get the ZIP file. Share the swiftui-preview folder with your agent.

  2. 2

    Your Agent Guides You Through Setup

    Your agent will follow instructions in INSTALL.md to help you set up the tool and install the plugin. You'll need to enable Xcode's Model Context Protocol (MCP) server and download Apple's device bezels from Apple Design Resources.

  3. 3

    Make it yours

    If a feature is missing or doesn’t work as expected, ask your agent to add commands, extend functionality, or update the plugin instructions with new rules to fit your workflow.

Let your agent check if SwiftUI Preview is right for you.

Just copy this prompt:

Read https://tools.natashatherobot.com/swiftui-preview.md, the page for SwiftUI Preview. Based on what you know about my projects and how I use Claude Code, would this tool be useful for my SwiftUI workflow? Consider how often I check UI changes, run the simulator, and test different devices and appearances. Explain whether it would save me time, if my setup meets the requirements, and whether it's worth the price. If it's not a good fit, tell me why. Ask me for more context if needed.

It is a starter tool

SwiftUI Preview is a starter tool you can customize to fit your workflow. You can use, copy, and change it for your own work in any number of projects, and your AI agents can read, run, and change it for you.

The full terms are in the LICENSE file included with your download. SwiftUI Preview comes without warranty.