by ParthJadhav
Automate Multi-Locale asset creation for your iOS app.
# Add to your Claude Code skills
git clone https://github.com/ParthJadhav/ios-marketing-captureAutomate reproducible marketing screenshot capture for a SwiftUI iOS app across multiple locales, with two parallel output streams:
This skill is the capture step. If the user also wants Apple-style marketing pages composited around the shots (device mockups, headlines, gradients), combine with the app-store-screenshots skill as a post-processing step.
In-app capture mode, not XCUITest. This is a hard decision that trades off against Fastlane snapshot / XCUITest conventions, and it wins for almost every real project.
Why in-app over XCUITest:
xcodebuild test. The whole flow is xcodebuild build once, then simctl launch per locale. No test-bundle overhead.UIWindow.drawHierarchy directly. XCUITest can only tap and read accessibility elements.ImageRenderer on widget views or isolated components must run inside the app process — there's no XCUITest equivalent.How it works:
MarketingCapture.swift file lives in the main app target-MarketingCapture 1, the app seeds data, then a coordinator walks a list of CaptureSteps — each step navigates, waits for settle, snapshots, and cleans upDocuments/marketing/<locale>/ directory-AppleLanguages (xx) -AppleLocale xx, pulling files out via simctl get_app_containerWork through these steps in order. Do not skip ahead.
Ask the user these questions one at a time (do not batch them — each answer can invalidate later questions):
Localizable.xcstrings, (b) an App Store subset I'll specify, or (c) let me give you an explicit list." If (a), grep the .xcstrings file for locale codes:
python3 -c "import json; d=json.load(open('<path>/Localizable.xcstrings')); langs=set(); [langs.update(v.get('localizations',{}).keys()) for v in d['strings'].values()]; print(sorted(langs))"
xcrun simctl list devices available.Before writing any code, explore the codebase enough to answer:
PBXFileSystemSynchronizedRootGroup)? If yes, new files auto-include in their target — no pbxproj edits needed. Check with grep -c PBXFileSystemSynchronized <proj>.xcodeproj/project.pbxproj.TabView(selection:) — most common. You need: the @State selectedTab binding, tab indices, and which tabs have nested NavigationStack.NavigationStack (single stack with a router) — you need: the path binding or router object, plus the set of NavigationLink(value:) / .navigationDestination types.NavigationSplitView — you need: the sidebar selection binding, detail column's navigation state.navigate(to:) method or equivalent.onOpenURL handler and the enum/switch that maps URLs to navigation state.ModelContext. If no seeder exists, see "Creating a demo data seeder" below.cloudKitDatabase: .automatic)? If yes, flag as a known gotcha.static var priming mechanism (see "Priming view state" below).Before writing code, summarize your plan in this structure. Get explicit approval before proceeding:
Use the templates in templates/ as starting points. They are reference patterns, not copy-paste scaffolding — every project has different navigation, models, and views. The templates show the building blocks; you compose them for the target app.
Key files to produce:
<AppName>/Debug/MarketingCapture.swift — the whole capture system, DEBUG-only. Contains:
MarketingCapture enum (launch arg parsing, output helpers, window snapshot, priming vars)MarketingCaptureCoordinator class (walks [CaptureStep] and snapshots each)MarketingElementHarness enum (ImageRenderer renders of cards, widgets, charts)<AppName>/ContentView.swift (or wherever the root view lives) — DEBUG hook that seeds data and runs the coordinator..onAppear hooks and .onReceive dismiss listeners.scripts/capture-marketing.sh — build + install + per-locale loop..gitignore — add marketing/.Do not hand the script to the user and wait. Run it yourself against a simulator and verify at least one locale before declaring done. Read the output PNGs with the Read tool to visually verify each screen shows what you expect. Common runtime issues are listed in "Known Gotchas" below.
When you find an issue, fix it, rerun the whole script (not just the failing locale — fixes can regress earlier locales), and re-verify visually.
The coordinator drives capture by walking a list of CaptureStep values. Each step is self-contained: it knows how to navigate to its screen, how long to wait, and how to clean up afterward.
struct CaptureStep {
let name: String // output filename, e.g. "01-home"
let navigate: @MainActor () -> Void // put the app in the right state
let settle: Duration // wait for animations/loads
let cleanup: (@MainActor () -> Void)? // tear down before next step
}
The coordinator is a simple loop:
for step in steps {
step.navigate()
try? await Task.sleep(for: step.settle)
if let image = MarketingCapture.snapshotKeyWindow() {
MarketingCapture.writePNG(image, name: step.name)
}
step.cleanup?()
try? await Task.sleep(for: .milliseconds(400)) // cleanup animation
}
TabView app (most common):
// Simple tab switch — just set the index
CaptureStep(name: "01-home", navigate: { setTab(0) }, settle: .milliseconds(1800), cleanup: nil)
// Tab + presented sheet
CaptureStep(
name: "05-timer-setup",
navigate: {
setTab(3)
pendingBrewRecipe = someRecipe
},
settle: .milliseconds(2000),
cleanup: {
NotificationCenter.default.post(name: MarketingCapture.dismissSheetNotification, object: nil)
pendingBrewRecipe = nil
}
)
NavigationStack + router app:
// Push a route onto the stack
CaptureStep(
name: "02-detail",
navigate: { router.push(.itemDetail(item)) },
settle: .milliseconds(1800),
cleanup: { router.popToRoot() }
)
NavigationSplitView app:
// Select sidebar item, then detail
CaptureStep(
name: "03-detail",
navigate: {
sidebarSelection = .recipes
detailSelection = recipes.first
},
settle: .milliseconds(1800),
cleanup: { detailSelection = nil }
)
Capture any screen that needs a "clean" navigation state BEFORE screens that push onto the same stack. Nested NavigationPath / @State inside child views can't be popped from the coordinator. So:
Good: Shelf (clean list) → Coffee Detail (pushes onto shelf's stack)
Bad: Coffee Detail → Shelf (stack still has detail pushed)
If two screens share a NavigationStack, capture the root-level view first.
Some screens need to be captured in a specific non-default state — a timer mid-countdown, a chart with particular values, a form half-filled. The pattern:
Add a static var to MarketingCapture for each priming value:
/// Set by the coordinator before presenting the timer view.
/// The view reads this in .onAppear to jump to a specific elapsed time.
static var pendingElapsedSeconds: Int?
/// Set to true to show the assessment overlay on the timer.
static var pendingShowAssessment: Bool = false
In the target view, add a DEBUG-gated .onAppear that reads the priming value:
.onAppear {
#if DEBUG
if MarketingCapture.isActive, let elapsed = MarketingCapture.pendingElapsedSeconds {
phase = .active
timerVM.elapsedTime = TimeInterval(elapsed)
timerVM.start()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { timerVM.pause() }
}
#endif
}
In the coordinator, set the var before navigating:
CaptureStep(
name: "06-timer-midway",
navigate: {
MarketingCapture.pendingElapsedSeconds = 75
openTimerSheet(someRecipe)
},
settle: .milliseconds(2400),
cleanup: {
MarketingCapture.pendingElapsedSeconds = nil
NotificationCenter.default.post(name: MarketingCapture.dismissSheetNotification, object: nil)
}
)
If the app has no existing demo data mechanism, create one. Place it in <AppName>/Debug/DemoDataSeeder.swift, wrapped in #if DEBUG.
Guidelines:
ModelContext. If Core Data, use the managed object context. If a REST backend, seed via the local cache/store layer.Minimal shape:
#if DEBUG
enum DemoDataSeeder {
static func seedIfEmpty(in context: ModelContext) {
let existing = (try? context.fetchCount(FetchDescriptor<Item>())) ?? 0
guard existing == 0 else { return }
// Items with varied states
let items = [
Item(name: "...", status: .active, ...),
Item(name: "...", status: .lowStock, ...),
// ...enough to fill every screen
]
items.forEach { context.insert($0) }
try? context.save()
}
}
#endif
Elements are rendered via ImageRenderer at 3x scale with transparency outside rounded corners.
@MainActor
static func renderCards(items: [Item], theme: AppTheme) {
let cardWidth: CGFloat = 380
for item in items {
let card = ItemCard(item: item, theme: theme)
.padding(.horizontal, 16)
.padding(.vertical, 12)
.frame(width: cardWidth)
.background(theme.background)
.clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous))
let renderer = ImageRenderer(content: card)
renderer.scale = 3
renderer.isOpaque = false
renderer.proposedSize = .init(width: cardWidth, height: nil)
guard let image = renderer.uiImage else { continue }
MarketingCapture.writePNG(image, name: "card-\(slugify(item.name))", subfolder: "elements")
}
}
Widget views require special handling because they normally run inside WidgetKit's process and rely on system-provided padding and backgrounds.
@MainActor
static func renderWidget(
name: String,
size: CGSize,
cornerRadius: CGFloat? = nil,
@ViewBuilder content: () -> some View
) {
let isAccessory = size.height <= 80
let radius = cornerRadius ?? (isAccessory ? 8 : 22)
let contentPadding: CGFloat = isAccessory ? 0 : 16
let view = content()
.padding(contentPadding)
.frame(width: size.width, height: size.height)
.background(theme.background)
.clipShape(RoundedRectangle(cornerRadius: radius, style: .continuous))
.environment(\.colorScheme, .light)
let renderer = ImageRenderer(content: view)
renderer.scale = 3
renderer.isOpaque = false
renderer.proposedSize = .init(width: size.width, height: size.height)
guard let image = renderer.uiImage else { return }
MarketingCapture.writePNG(image, name: name, subfolder: "elements")
}
// Standard iPhone widget sizes (points, iPhone 14-17 size class)
enum WidgetSize {
static let small = CGSize(width: 170, height: 170)
static let medium = CGSize(width: 364, height: 170)
static let large = CGSize(width: 364, height: 382)
static let accessoryCircular = CGSize(width: 76, height: 76)
static let accessoryRectangular = CGSize(width: 172, height: 76)
static let accessoryInline = CGSize(width: 257, height: 26)
}
// Usage:
renderWidget(name: "widget-pulse-small", size: WidgetSize.small) {
PulseSmallView(entry: PulseEntry(
date: Date(),
count: 2,
streak: 5,
lastItemName: "Morning Routine"
))
}
Any SwiftUI view can be rendered as an element. Wrap it the same way — explicit size, background, corner clip:
@MainActor
static func renderChart() {
let chart = MyChartView(values: ChartData.sample)
.frame(width: 420, height: 420)
.background(theme.background)
.clipShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
let renderer = ImageRenderer(content: chart)
renderer.scale = 3
renderer.isOpaque = false
renderer.proposedSize = .init(width: 420, height: 420)
guard let image = renderer.uiImage else { return }
MarketingCapture.writePNG(image, name: "chart-overview", subfolder: "elements")
}
These are all real bugs that bit a real project. Treat this list as load-bearing.
ActivityKit Live Activities outlive process termination. If your app starts a Live Activity during capture (e.g. via a timer's start()), then the next locale's relaunch will inherit it. Combined with a fresh seed that deletes the models the stale LA references, you get SwiftData persisted-property assertions.
Fix: call <ActivityManager>.shared.endImmediately() at the very start of the marketing capture block, before touching data. Also call timerVM.stop() (or whatever properly ends the LA) in the view's onDisappear when in capture mode.
Seeding SwiftData + CloudKit per locale causes sync churn and crashes. The SwiftData store persists across relaunches — the data is locale-agnostic demo content, so seed once on the first run and skip subsequent runs:
contentVM.fetchItems()
if contentVM.allItems.isEmpty {
DemoDataSeeder.seedIfEmpty(in: modelContext)
contentVM.fetchItems()
}
If the root view's onAppear calls someVM.setup(modelContext:) before the marketing seed runs, the VM holds a snapshot of the empty store. After seeding, call someVM.refresh() (or its equivalent fetch method) for every VM whose data you need.
If a parent view presents a .fullScreenCover(item: $request) and request is driven by an internal @State, then setting the trigger binding (e.g. pendingItem = nil) does nothing to the cover. The cover stays up, and your next screenshot captures it instead of the screen you navigated to.
Fix: broadcast a dismiss signal via NotificationCenter, and have the presented view listen:
// MarketingCapture.swift
static let dismissSheetNotification = Notification.Name("MarketingCapture.dismissSheet")
// In presented view body
.onReceive(NotificationCenter.default.publisher(for: MarketingCapture.dismissSheetNotification)) { _ in
dismiss()
}
Then in the step's cleanup, post the notification and allow at least 900ms for the cover animation to complete before the next step begins.
If a child view holds @State private var navigationPath = NavigationPath() and a deep link pushes onto it, the coordinator can't reach in to pop. Solution: reorder your capture sequence so screens that push onto a stack come AFTER screens that need a clean stack. Example: capture Shelf first, then push into Coffee Detail — don't do it the other way around.
If the user's widget views are only in the widget extension target, you can't reference them from MarketingCapture.swift in the main app target. You need to either:
PBXFileSystemSynchronizedBuildFileExceptionSet.membershipExceptions. CRITICAL GOTCHA: membershipExceptions is an INCLUSION list, not an exclusion list. Files listed there ARE members of the target, not excluded from it. Read this twice before editing.You'll also need to exclude <App>WidgetBundle.swift from the main app target (it has @main and conflicts with the app's @main).
ImageRenderer + ProgressView(value:total:) = prohibited symbolWithout an explicit style, ProgressView determinate renders as a red circle-with-slash when composited through ImageRenderer. Fix: .progressViewStyle(.linear) on the ProgressView. It's a no-op in normal rendering and fixes the render glitch.
.containerBackground(for: .widget) is a no-op outside widget contextWhen you render a widget view via ImageRenderer in the app, its .containerBackground does nothing — the widget's background is transparent, and pixels outside the content are bare. You must wrap the widget render with an explicit background color + rounded rect clip:
content()
.padding(16) // widget container normally provides this
.frame(width: size.width, height: size.height)
.background(theme.background)
.clipShape(RoundedRectangle(cornerRadius: 22, style: .continuous))
Home-screen widget corner radius on iPhone: ~22pt. Lock-screen accessory radius: ~8pt.
If the user asks for a "6.5" iPhone" (legacy App Store size), note that iOS 26+ simulators don't include iPhone 8 Plus / iPhone 11 Pro Max. Options: (a) install an older iOS runtime via Xcode > Settings > Platforms, or (b) fall back to a modern 6.1" like iPhone 17 for iOS 26 design features.
Pass -AppleLanguages (xx) -AppleLocale xx at every simctl launch. The parens around the language code are mandatory (it's a plist array literal). Use Locale.current.language.languageCode?.identifier for folder naming — it's more robust than Locale.current.identifier which may include region suffixes like en_US.
ImageRenderer captures a single frame — it doesn't wait for animations. If your component has an .onAppear animation (chart drawing, number counting up), the render may capture the initial state. Either disable the animation in capture mode or add an explicit delay before rendering:
try? await Task.sleep(for: .milliseconds(500)) // let onAppear animations finish
let renderer = ImageRenderer(content: view)
marketing/
<locale>/ e.g. en, de, es, fr, ja
01-home.png
02-<screen>.png
...
NN-<screen>.png
elements/
card-<name>.png
widget-<family>-<size>.png
chart-<name>.png
Put marketing/ in .gitignore. These are outputs, not source.
Before declaring the capture pipeline done, verify:
en/settings.png and de/settings.png are byte-identical, locale switching didn't take effect)templates/MarketingCapture.swift.template — skeleton of the capture file with step-based coordinator. Reference the body of this skill for the patterns to apply.templates/capture-marketing.sh.template — skeleton of the shell script. Replace the bundle ID, scheme name, and simulator name for each project.A skill for AI-powered coding agents (Claude Code, Cursor, Windsurf, etc.) that automates marketing screenshot capture for SwiftUI iOS apps. It builds an in-app capture system, seeds demo data, snapshots every screen and UI element, and loops across all your locales automatically.
#if DEBUG-gated capture system to your app target — zero production footprintImageRenderer at 3x with transparency-AppleLanguagesTabView, NavigationStack, NavigationSplitViewnpx skills add ParthJadhav/ios-marketing-capture
This works with Claude Code, Cursor, Windsurf, OpenCode, Codex, and 40+ other agents.
Install globally (available across all projects):
npx skills add ParthJadhav/ios-marketing-capture -g
Install for a specific agent:
npx skills add ParthJadhav/ios-marketing-capture -a claude-code
git clone https://github.com/ParthJadhav/ios-marketing-capture ~/.claude/skills/ios-marketing-capture
Once installed, the skill triggers automatically when you ask your agent to:
Or just tell the agent what you need:
> Capture marketing screenshots for my app across all locales
The agent will ask you about your screens, elements, locales, device, appearance, and seed data before writing any code.
These are good starting prompts because they provide context while still leaving room for the skill to guide the process.
Capture marketing screenshots for my coffee tracking app.
I want Home, Shelf, Coffee Detail, Brew Timer, and Settings.
Also render coffee cards and all my widgets as isolated elements.
Capture across en, de, es, fr, ja.
Generate locale screenshots for my habit tracker app.
I need the dashboard, habit detail, streak view, and settings.
Light mode only, iPhone 17 simulator.
All 5 locales in my Localizable.xcstrings.
Capture marketing assets for my finance app.
I want the overview, transaction list, budget detail, and charts.
Render the spending chart and category cards as isolated elements.
English and German only.
Automate App Store screenshot capture for my workout app.
Capture the main dashboard, workout detail mid-session, and history.
Render all my WidgetKit widgets (small, medium, lock screen) as isolated PNGs.
The skill uses an in-app capture approach instead of XCUITest / Fastlane:
ImageRenderer, UIWindow.drawHierarchyxcodebuild build once, then simctl launch per locale (no test-bundle overhead)ImageRenderer on widget views must run inside the app processEach screenshot is a self-contained CaptureStep:
struct CaptureStep {
let name: String // "01-home"
let navigate: @MainActor () -> Void // put the app in the right state
let settle: Duration // wait for animations
let cleanup: (@MainActor () -> Void)? // tear down before next step
}
The coordinator is a simple loop — no hardcoded screen sequences. The agent composes steps for your specific navigation architecture.
The skill covers three navigation architectures:
| Pattern | How steps drive it |
|---------|-------------------|
| TabView(selection:) | setTab(index) |
| NavigationStack + router | router.push(.route) / router.popToRoot() |
| NavigationSplitView | Set sidebar + detail selection bindings |
Isolated components are rendered via ImageRenderer at 3x scale with natural background inside rounded corners and transparency outside:
MarketingElementHarness.renderElement(
name: "card-morning-blend",
width: 380,
cornerRadius: 20,
background: theme.background
) {
CoffeeCard(coffee: coffee, theme: theme)
.padding(.horizontal, 16)
.padding(.vertical, 12)
}
Widget rendering handles the quirks of rendering WidgetKit views outside the widget process (missing containerBackground, missing padding, ProgressView rendering bugs).
The skill guides the agent to create:
YourApp/
├── Debug/
│ └── MarketingCapture.swift # Capture system (DEBUG-only)
├── ContentView.swift # Modified — DEBUG hook for seed + coordinator
├── Views/.../TimerView.swift # Modified — primed state hooks (if needed)
scripts/
└── capture-marketing.sh # Build + install + per-locale loop
marketing/
en/
01-home.png
02-detail.png
03-settings.png
elements/
card-morning-blend.png
widget-pulse-small.png
chart-cupping.png
de/
...
es/
...
The skill documents 11 real bugs discovered during development. These are all baked into the skill's guidance so the agent avoids them automatically:
| # | Gotcha | What happens |
|---|--------|--------------|
| 1 | Live Activities persist across launches | Next locale crashes on stale SwiftData references |
| 2 | Re-seeding per locale | CloudKit sync churn causes crashes |
| 3 | VMs setup before seed | Hold stale empty snapshots |
| 4 | Setting trigger binding to nil | Doesn't dismiss fullScreenCover — wrong screenshot |
| 5 | NavigationPath can't be popped externally | Must capture clean stack before pushed detail |
| 6 | membershipExceptions is an INCLUSION list | Widget target membership goes backwards |
| 7 | ImageRenderer + ProgressView | Renders as prohibited symbol without explicit style |
| 8 | .containerBackground outside WidgetKit | No-op — widget renders have no background |
| 9 | iPhone 8 Plus gone on iOS 26 | Legacy 6.5" simulator unavailable |
| 10 | Locale launch argument format | Parens are mandatory: (xx) not xx |
| 11 | SwiftUI animations in ImageRenderer | Captures frame 0, not the animated state |
Use app-store-screenshots as a post-processing step to composite the captured PNGs into Apple-style marketing pages with device mockups, headlines, and gradients.
ImageRenderer, @Observable)Contributions are welcome, especially around:
MIT
No comments yet. Be the first to share your thoughts!