What this thread does
As of November 2026, XcodePreviews documents a Codex skill as well as Claude Code and Cursor setup. Do first: follow the README’s integration section for your agent, then request a preview of one SwiftUI file.
The problem
An agent writes SwiftUI from the source alone, so spacing and layout mistakes show up only when you run the app and paste a screenshot back. An r/iOSProgramming post (16 Feb 2026) shared a way to give the agent that view.
What the toolkit does
The project is Iron-Ham's XcodePreviews (earlier named Claude-XcodePreviews; MIT licence). From its README: for a Swift file with a #Preview block, it extracts the preview content, injects a temporary PreviewHost target into your Xcode project, wires up only the dependencies the file imports, builds just those modules, launches the host in the Simulator, captures a screenshot and removes the injected target. For Swift packages it creates a temporary Xcode project instead. Cached builds are claimed to take about 3 to 4 seconds (the post says about 20 seconds for a package and about 5 seconds for a single file; these are the author's numbers).
In Claude Code you install it from the plugin marketplace and run /preview path/to/MyView.swift; the README documents a Cursor skill install; the README now also documents Codex installation. Set PREVIEW_BUILD_PATH to the clone's absolute path and copy .codex/skills/xcode-preview-capture/ into ~/.codex/skills/public/xcode-preview-capture/. The skill uses scripts/preview, reads the resulting screenshot and provides UI analysis. It needs macOS, Xcode and the iOS Simulator.
What commenters said
- It helps. Several commenters said they were plugging it in or that pasting failing UI screenshots had been a pain; one user said they were adding it to their workflow after the author's explanation. These are short endorsements, not tests.
- Xcode's own MCP can grab previews, for one agent. A commenter says Xcode's MCP server has this capability. The author replies that it holds only with exactly one agent: with several worktrees each checkout needs its own running Xcode instance and simultaneous builds are not handled. Another commenter says the Xcode MCP is very buggy and its connection popup spams when several copies of an agent connect, and expects Apple to fix it (a prediction). See the existing thread on Xcode's MCP for setup.
- Plugin or generic skill? A commenter asked why it is tied to Claude's plugin system; the author says it is installable as a plain skill plus scripts and that they build Claude-first.
- Limit of screenshots. A commenter points out that padding mistakes can be seen from code, while glitches during interaction or animation need more than a still image.
What to check before using it
- It edits your
.xcodeprojtemporarily and runs scripts. Use it on a clean git state so you can see what it changed, and read the scripts first. - Performance numbers and the "preview per worktree" advantage are from the author. Two commenters report using it; nobody posted a comparison.
- It overlaps with Apple's SwiftUI previews in Xcode and with simulator-driving MCP servers; it adds the single-file render and screenshot step.
Sources
- Iron-Ham/XcodePreviews README: preview extraction, temporary host targets, package support, cleanup, requirements and Claude Code, Cursor and Codex setup.
- Iron-Ham's r/iOSProgramming post and replies: timing claims and the author’s worktree comparison. These are author and commenter reports, not independent performance measurements.
Started from a post by @Iron-Ham, packaged by the editor. Original post