Skip to main content

Automating App Store screenshots with Claude Code

10 min read

Reckon, my decision journal, and Digest, a food journal I'm working on, both automate their App Store screenshots from inside the app.

Every screenshot is a SwiftUI view in the debug build, made of the app’s real components over sample data in an in-memory container, and the app draws it into a PNG itself, at the exact size App Store Connect wants; there's no screenshot of the simulator involved. So if I change a component, every screenshot that shows it changes on the next export, in every set.

The screenshots code was fully created with Claude Code (as usual, under my guidance), and through the simulator integration it also runs the app and exports the screenshots, so the process is kinda fully automated, I just brainstorm with it. Uploading the sets and testing them against each other is its own post (also kinda automated), so this one stops at the PNGs.

If you search for how to automate App Store screenshots, the usual answer is fastlane. Its snapshot runs UI tests that tap through the app and call snapshot("name") on every screen worth keeping, then frameit puts a device frame, a title and a background around each capture.

That works pretty well when your screenshots are screens, but most of mine aren’t, so snapshot doesn't really work at all.

Reckon’s first screenshot: the headline “Make better decisions.” over 3 resolved decision rows, right, wrong and mixed, floating on a green ground with no device

Rendering inside the app

It didn’t actually start in the app. I use Claude Design for interface work, so my original ask was for Claude Design prompts, and a Figma MCP server was the other option on the table.

Both lost, for different reasons. A design tool can only paste in crops of real screens, while the app can render UI elements themselves, in whatever state a screenshot needs. I think code that can be built and run is a much better place for it. And once the screenshots are code, the next test round, a copy fix or a new device size are just an edit and an export.

Everything related to this lives in one folder that’s #if DEBUG from the first line to the last, so none of it ships. A set is an ordered list of screenshot specs plus a palette, and a spec is a headline, an optional subhead and a hero, the visual under the headline.

The sets only differ in their copy, their first screenshot’s hero or their structure, and share the rest; that’s what keeps Reckon’s 9 of them from drifting apart, and why a copy edit is one line. A few tests pin that down, too: unique ids, every emphasized word actually present in its headline, 3 sets per test round, etc.

The one thing a capture can’t do is lift a component out of a screen. In Reckon’s third screenshot, the confidence slider floats over the check-in screen it came from, at full size, and it’s the app’s own slider card, fed sample values instead of a view model:

Reckon’s third screenshot: the headline “Something changed?” over the check-in screen, with the confidence slider card lifted out and floating over it

The screens underneath are composed from the app’s real rows and cards, laid out at the app’s width, with exactly the rows a screenshot needs. In Reckon, even their labels come from the same code the app uses, so a screenshot can’t show anything the app wouldn’t show for the same data.

As for the device around them, it’s drawn in SwiftUI as well: the bezel, the corners, the status bar and the iPhone’s Dynamic Island, at the real screen’s size. That part is no different from putting a screenshot in a clay iPhone mockup in Figma or similar, it’s just done in code.

There’s a catch, though. A change to a screen’s arrangement, like a new section or a moved control, won’t reach the screenshots by itself; I have to update the composition too. A change inside a component does reach them, on the next export, everywhere that component shows up.

The screenshots get their own data, too. I keep a private in-memory SwiftData container with one story followed across the set, and every number a headline quotes lives in there and nowhere else.

Then I pin everything that could move. The screenshots’ “today” is 13 September 2026, and the settings come from their own suite, not the simulator’s. The app formats dates with the device’s region, so a US simulator might print “May 16” where the screenshots say “16 May”; the exporter just refuses a month-first region.

I keep these fixtures apart from the demo data in both apps, so staging something for a manual test can’t move a headline’s number.

iPad isn’t a second set of views either: the same specs render on a second canvas, where the composed screens draw the app’s split view, laid out to measurements from real captures. I first planned iPad screenshots only for whichever set won the A/B test, until it turned out every set in the test needs both.

The same check-in screenshot on iPad: the lifted slider over the app’s split view, with the decisions list on the left

Digest’s renderer came a few days later and by then, the method was written down where Claude Code reads it (it’s a skill now), so Digest’s is mostly a port: the generic files nearly verbatim, with the look from Digest’s own brief.

Digest’s first screenshot, “Log a meal in 10 seconds”, with the log sheet floated over the Today screen, on a dark green ground

So now, for a new project, I just write its brief, have Claude build the in-code logic and reuse the skill.

The export

The app hosts each screenshot in its own full-screen window, above anything else on screen, and draws that window into a PNG with drawHierarchy(in:afterScreenUpdates:), UIKit’s way of drawing a view exactly as it looks at that moment.

Why not ImageRenderer, SwiftUI’s view-to-image API? It leaves UIKit-backed views blank, and SwiftUI’s Slider, List and text fields are UIKit underneath, which are pretty much the controls the screenshots exist to show. So each screenshot really has to be on screen, and it flashes on the simulator for a moment while it’s drawn.

That also means the simulator decides the size. The window is drawn at the screen’s scale, so the canvas has to be the simulator’s screen: an iPhone 17 Pro Max gives 1320×2868 and an iPad Pro 13-inch 2064×2752, which is what App Store Connect wants for the largest iPhone and iPad.

The first version used the older 1290×2796, and I saw white strips on the right and bottom of the simulator, then black ones, and Claude explained them twice before checking any sizes. The PNGs were clean, it turned out, and the strips were just the simulator’s screen past a smaller window. Now the exporter refuses any simulator whose screen isn’t a canvas, and the error names the 2 that work.

It also refuses to write a wrong screenshot, one that renders fine but not the way it was designed, with something missing or out of place. Those are easy to miss in a folder of over 100 PNGs, so the export checks what it can and, when a check fails, stops for that screenshot instead of writing it. A warning in the log, in the middle of a run, is one nobody reads.

A few smaller traps, which might save you some time if you build your own:

  • A hero sized to its content pushed the headline off the top on a tall device, so heroes now fill a fixed area and clip whatever doesn’t fit.
  • Views that tell rows apart by persistentModelID need the fixtures actually inserted into the container; otherwise every row shares one temporary id and they all collapse into one.
  • Renaming a screenshot left its old PNG behind, so the export removes stale ones now.

Letting Claude Code run it

In Reckon, the export is a button in Settings: Showcase Frames, “Export all frames”. Claude Code builds the debug app, launches it on the iPhone 17 Pro Max simulator, taps its way to the button and waits for the progress line to finish, then does the same on the iPad, and before anything gets committed, it reads a few of the PNGs back.

That’s 106 screenshots in 2 runs.

The tapping is probably the most fragile part. The simulator integration’s screenshots can fail for a whole session, and then the model taps by coordinates it saw earlier, more or less blind (that, and the rest of what goes wrong around the simulator, is its own post).

But the export doesn’t really need any of that, only a foreground scene, so in Digest I improved this a bit and skip the button and start from a launch argument:

xcrun simctl launch --terminate-running-process <device> <bundleId> -exportMarketingFrames

On the app side, a modifier on the root view waits for the scene to become active, and runs the export once:

.task(id: scenePhase) {
   guard scenePhase == .active, !hasStarted, ProcessInfo.processInfo.arguments.contains(Self.argument) else {
      return
   }
 
   hasStarted = true
 
   // [...]
 
   await viewModel.export(variants)
 
   // [...]
}

hasStarted is there because the scene can go inactive and active again mid-run, and the result goes to the log, since nobody’s looking at a screen.

If I add -marketingVariant 00-default, it just exports a single set. Launch arguments in the -key value form land in UserDefaults, so the app reads it with one string(forKey:); an unknown id throws, instead of exporting nothing or everything, either of which would look like a result.

Where do the files go?

Straight into the repository. The exporter works out the output folder from its own source file path at compile time (#filePath), and since an app running in the simulator can write to the Mac’s disk, the PNGs actually end up in the checkout the app was built from.

I commit them, too. The script that uploads them to App Store Connect (more on it in the A/B testing post) reads them from there, and a copy change shows up in review as an image diff. Not a perfectly clean one, though.

A rerun rewrites unchanged screenshots with sub-pixel differences in charts and shadows, so exporting everything to change one set touches every other set’s PNGs as well; that’s why -marketingVariant exists.

What’s left for me, then?

Well, the brainstorming, and most of it happens before any screenshot code: the brief, the fixtures and the hooks, the things no layout tweak can fix later.

Picking the hooks, running the test and the upload script behind it are in the A/B testing post.

Previews (videos) are rendered as well, though outside the app, and that’s the next post.

If you’ve found a way to automate yours some other way, let me know @roland.leth.ro or @rolandleth!

The rest of the series is listed in Claude Code for iOS development, and the post before this one is Testing code when you don’t know the right answer.