Skip to content
Back to search

ios-marketing-capture

Use when the user wants to automate capture of marketing screenshots for a SwiftUI iOS app across multiple locales, devices, or appearances. Covers full-screen shots, isolated element renders (carousel cards, widgets), and reproducible output naming. Triggers on marketing screenshots, locale screenshots, widget renders, App Store assets, fastlane-alternative, simctl screenshots.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/parthjadhav--ios-marketing-capture/badge.svg)](/listings/parthjadhav--ios-marketing-capture)

HTML

<a href="/listings/parthjadhav--ios-marketing-capture"><img src="/api/listings/parthjadhav--ios-marketing-capture/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Using npx skills (recommended)

npx skills add ParthJadhav/ios-marketing-capture

This works with Claude Code, Cursor, Windsurf, OpenCode, Codex, and [40+ other agents](https://github.com/vercel-labs/skills#available-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

Manual (git clone)

git clone https://github.com/ParthJadhav/ios-marketing-capture ~/.claude/skills/ios-marketing-capture

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 494 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. ---
  2. name: ios-marketing-capture
  3. description: Use when the user wants to automate capture of marketing screenshots for a SwiftUI iOS app across multiple locales, devices, or appearances. Covers full-screen shots, isolated element renders (carousel cards, widgets), and reproducible output naming. Triggers on marketing screenshots, locale screenshots, widget renders, App Store assets, fastlane-alternative, simctl screenshots.
  4. ---
  5. # iOS Marketing Capture
  6. ## Overview
  7. Automate reproducible marketing screenshot capture for a SwiftUI iOS app across multiple locales, with two parallel output streams:
  8. 1. **Full-screen captures** — every marketing-relevant screen, with deterministic seeded data, real status bar / safe-area chrome
  9. 2. **Element captures** — isolated renders of specific components (cards, widgets, charts) at any scale, with natural background inside rounded corners and transparency outside
  10. 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.
  11. ## Core Approach
  12. **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.
  13. Why in-app over XCUITest:
  14. - **No new test target.** Adding a UI test target to an existing Xcode project is fragile pbxproj surgery. Many projects have zero test targets and no xcodegen — adding one by hand is error-prone.
  15. - **Faster iteration.** A UI test takes 30s+ to launch per run. In-app capture is just a relaunch of the installed binary.
  16. - **No `xcodebuild test`.** The whole flow is `xcodebuild build` once, then `simctl launch` per locale. No test-bundle overhead.
  17. - **Access to real app state.** You can call ViewModels, SwiftData, ImageRenderer, and `UIWindow.drawHierarchy` directly. XCUITest can only tap and read accessibility elements.
  18. - **Element renders need in-process anyway.** `ImageRenderer` on widget views or isolated components must run inside the app process — there's no XCUITest equivalent.
  19. How it works:
  20. 1. A DEBUG-only `MarketingCapture.swift` file lives in the main app target
  21. 2. When launched with `-MarketingCapture 1`, the app seeds data, then a coordinator walks a list of `CaptureStep`s — each step navigates, waits for settle, snapshots, and cleans up
  22. 3. PNGs are written to the app's sandbox `Documents/marketing/<locale>/` directory
  23. 4. A shell script builds once, installs, then loops locales by relaunching with `-AppleLanguages (xx) -AppleLocale xx`, pulling files out via `simctl get_app_container`
  24. ## Process
  25. Work through these steps in order. Do not skip ahead.
  26. ### Step 1: Gather requirements
  27. Ask the user these questions **one at a time** (do not batch them — each answer can invalidate later questions):
  28. 1. **Screens to capture** — "Which screens do you want? Give me the navigation path or the tab name for each." Get a concrete list, not "the main flows".
  29. 2. **Isolated elements** — "Any components you want rendered independently with transparent backgrounds? (carousel cards, widgets, hero tiles, charts, etc.)"
  30. 3. **Locales** — "Which locales? (a) all locales in your `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:
  31. ```bash
  32. 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))"
  33. ```
  34. 4. **Device** — "Which simulator? (6.1\" iPhone 17 recommended for iOS 26 design features)" — verify the device is available via `xcrun simctl list devices available`.
  35. 5. **Appearance** — "Light only, dark only, or both?"
  36. 6. **Seed data** — "How is demo data populated today? (a) fresh install seeds it automatically, (b) there's a debug 'Load Demo Data' button, (c) you add it manually, (d) no demo data exists yet." Then: "Is the existing data exhaustive enough that every screen you listed looks populated for marketing? Audit it with the user."
  37. ### Step 2: Exploration
  38. Before writing any code, explore the codebase enough to answer:
  39. - Does the project use **Xcode synchronized folder groups** (Xcode 16+, `PBXFileSystemSynchronizedRootGroup`)? If yes, new files auto-include in their target — no pbxproj edits needed. Check with `grep -c PBXFileSystemSynchronized <proj>.xcodeproj/project.pbxproj`.
  40. - **What is the root navigation pattern?**
  41. - `TabView(selection:)` — most common. You need: the `@State selectedTab` binding, tab indices, and which tabs have nested `NavigationStack`.
  42. - `NavigationStack` (single stack with a router) — you need: the path binding or router object, plus the set of `NavigationLink(value:)` / `.navigationDestination` types.
  43. - `NavigationSplitView` — you need: the sidebar selection binding, detail column's navigation state.
  44. - Custom coordinator / UIKit host — you need: the coordinator's `navigate(to:)` method or equivalent.
  45. - How are **deep links** routed? Find the `onOpenURL` handler and the enum/switch that maps URLs to navigation state.
  46. - Where are **demo data seeders** defined? Trace the code path from the debug button (if any) to the function that actually writes to `ModelContext`. If no seeder exists, see "Creating a demo data seeder" below.
  47. - Do **widgets** live in a separate target? Are the widget view files and entry types in the main app target too? (Almost certainly no — they need to be added if you want to render them via ImageRenderer.)
  48. - Does the app use **Live Activities** / ActivityKit? If yes, flag this as a known gotcha (see below).
  49. - Does the app use **SwiftData + CloudKit sync** (`cloudKitDatabase: .automatic`)? If yes, flag as a known gotcha.
  50. - Does any view need to be **captured in a non-default state**? (e.g. a timer mid-countdown, a form partially filled, a chart with specific values). If yes, each needs a `static var` priming mechanism (see "Priming view state" below).
  51. ### Step 3: Present design to user
  52. Before writing code, summarize your plan in this structure. Get explicit approval before proceeding:
  53. 1. Architecture (in-app capture mode, single file, DEBUG-gated)
  54. 2. File list (exact paths you'll create / modify)
  55. 3. Screen-by-screen capture plan (how each screen is reached — tab index, navigation path, sheet trigger)
  56. 4. Capture ordering rationale (which screens must come before others — see gotcha #5)
  57. 5. Element rendering approach (which components, how they'll be wrapped)
  58. 6. Output layout (folder structure, naming convention)
  59. 7. Known gotchas relevant to this project (flagged from Step 2)
  60. 8. Primed states needed (which views, what static vars)
  61. ### Step 4: Implement
  62. 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.
  63. Key files to produce:
  64. - `<AppName>/Debug/MarketingCapture.swift` — the whole capture system, DEBUG-only. Contains:
  65. - `MarketingCapture` enum (launch arg parsing, output helpers, window snapshot, priming vars)
  66. - `MarketingCaptureCoordinator` class (walks `[CaptureStep]` and snapshots each)
  67. - `MarketingElementHarness` enum (ImageRenderer renders of cards, widgets, charts)
  68. - `<AppName>/ContentView.swift` (or wherever the root view lives) — DEBUG hook that seeds data and runs the coordinator.
  69. - Any views that need primed states — DEBUG-gated `.onAppear` hooks and `.onReceive` dismiss listeners.
  70. - `scripts/capture-marketing.sh` — build + install + per-locale loop.
  71. - `.gitignore` — add `marketing/`.
  72. ### Step 5: Verify iteratively
  73. 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.
  74. 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.
  75. ## Architecture: Step-Based Capture
  76. 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.
  77. ```swift
  78. struct CaptureStep {
  79. let name: String // output filename, e.g. "01-home"
  80. let navigate: @MainActor () -> Void // put the app in the right state
  81. let settle: Duration // wait for animations/loads
  82. let cleanup: (@MainActor () -> Void)? // tear down before next step
  83. }
  84. ```
  85. The coordinator is a simple loop:
  86. ```swift
  87. for step in steps {
  88. step.navigate()
  89. try? await Task.sleep(for: step.settle)
  90. if let image = MarketingCapture.snapshotKeyWindow() {
  91. MarketingCapture.writePNG(image, name: step.name)
  92. }
  93. step.cleanup?()
  94. try? await Task.sleep(for: .milliseconds(400)) // cleanup animation
  95. }
  96. ```
  97. ### Building steps for different navigation patterns
  98. **TabView app** (most common):
  99. ```swift
  100. // Simple tab switch — just set the index
  101. CaptureStep(name: "01-home", navigate: { setTab(0) }, settle: .milliseconds(1800), cleanup: nil)
  102. // Tab + presented sheet
  103. CaptureStep(
  104. name: "05-timer-setup",
  105. navigate: {
  106. setTab(3)
  107. pendingBrewRecipe = someRecipe
  108. },
  109. settle: .milliseconds(2000),
  110. cleanup: {
  111. NotificationCenter.default.post(name: MarketingCapture.dismissSheetNotification, object: nil)
  112. pendingBrewRecipe = nil
  113. }
  114. )
  115. ```
  116. **NavigationStack + router app:**
  117. ```swift
  118. // Push a route onto the stack
  119. CaptureStep(
  120. name: "02-detail",
  121. navigate: { router.push(.itemDetail(item)) },
  122. settle: .milliseconds(1800),
  123. cleanup: { router.popToRoot() }
  124. )
  125. ```
  126. **NavigationSplitView app:**
  127. ```swift
  128. // Select sidebar item, then detail
  129. CaptureStep(
  130. name: "03-detail",
  131. navigate: {
  132. sidebarSelection = .recipes
  133. detailSelection = recipes.first
  134. },
  135. settle: .milliseconds(1800),
  136. cleanup: { detailSelection = nil }
  137. )
  138. ```
  139. ### Ordering: the stacking rule
  140. **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:
  141. ```
  142. Good: Shelf (clean list) → Coffee Detail (pushes onto shelf's stack)
  143. Bad: Coffee Detail → Shelf (stack still has detail pushed)
  144. ```
  145. If two screens share a NavigationStack, capture the root-level view first.
  146. ## Priming View State
  147. 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:
  148. 1. Add a `static var` to `MarketingCapture` for each priming value:
  149. ```swift
  150. /// Set by the coordinator before presenting the timer view.
  151. /// The view reads this in .onAppear to jump to a specific elapsed time.
  152. static var pendingElapsedSeconds: Int?
  153. /// Set to true to show the assessment overlay on the timer.
  154. static var pendingShowAssessment: Bool = false
  155. ```
  156. 2. In the target view, add a DEBUG-gated `.onAppear` that reads the priming value:
  157. ```swift
  158. .onAppear {
  159. #if DEBUG
  160. if MarketingCapture.isActive, let elapsed = MarketingCapture.pendingElapsedSeconds {
  161. phase = .active
  162. timerVM.elapsedTime = TimeInterval(elapsed)
  163. timerVM.start()
  164. DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) { timerVM.pause() }
  165. }
  166. #endif
  167. }
  168. ```
  169. 3. In the coordinator, set the var before navigating:
  170. ```swift
  171. CaptureStep(
  172. name: "06-timer-midway",
  173. navigate: {
  174. MarketingCapture.pendingElapsedSeconds = 75
  175. openTimerSheet(someRecipe)
  176. },
  177. settle: .milliseconds(2400),
  178. cleanup: {
  179. MarketingCapture.pendingElapsedSeconds = nil
  180. NotificationCenter.default.post(name: MarketingCapture.dismissSheetNotification, object: nil)
  181. }
  182. )
  183. ```
  184. ## Creating a Demo Data Seeder
  185. If the app has no existing demo data mechanism, create one. Place it in `<AppName>/Debug/DemoDataSeeder.swift`, wrapped in `#if DEBUG`.
  186. Guidelines:
  187. - Seed **enough data that every captured screen looks populated**. Audit the screen list against the seed.
  188. - Use realistic content: real place names, plausible numbers, varied states (some items "running low", some "fresh", some with images, some without).
  189. - If the app uses SwiftData, write directly to the `ModelContext`. If Core Data, use the managed object context. If a REST backend, seed via the local cache/store layer.
  190. - Make seeding **idempotent** — check if data already exists before inserting. The store persists across simulator relaunches, and re-seeding per locale causes CloudKit sync churn and crashes.
  191. - Include enough variety to fill different UI states: empty states should NOT appear unless they're a marketing screen.
  192. Minimal shape:
  193. ```swift
  194. #if DEBUG
  195. enum DemoDataSeeder {
  196. static func seedIfEmpty(in context: ModelContext) {
  197. let existing = (try? context.fetchCount(FetchDescriptor<Item>())) ?? 0
  198. guard existing == 0 else { return }
  199. // Items with varied states
  200. let items = [
  201. Item(name: "...", status: .active, ...),
  202. Item(name: "...", status: .lowStock, ...),
  203. // ...enough to fill every screen
  204. ]
  205. items.forEach { context.insert($0) }
  206. try? context.save()
  207. }
  208. }
  209. #endif
  210. ```
  211. ## Element Rendering
  212. Elements are rendered via `ImageRenderer` at 3x scale with transparency outside rounded corners.
  213. ### Cards / list rows
  214. ```swift
  215. @MainActor
  216. static func renderCards(items: [Item], theme: AppTheme) {
  217. let cardWidth: CGFloat = 380
  218. for item in items {
  219. let card = ItemCard(item: item, theme: theme)
  220. .padding(.horizontal, 16)
  221. .padding(.vertical, 12)
  222. .frame(width: cardWidth)
  223. .background(theme.background)
  224. .clipShape(RoundedRectangle(cornerRadius: 20, style: .continuous))
  225. let renderer = ImageRenderer(content: card)
  226. renderer.scale = 3
  227. renderer.isOpaque = false
  228. renderer.proposedSize = .init(width: cardWidth, height: nil)
  229. guard let image = renderer.uiImage else { continue }
  230. MarketingCapture.writePNG(image, name: "card-\(slugify(item.name))", subfolder: "elements")
  231. }
  232. }
  233. ```
  234. ### Widgets
  235. Widget views require special handling because they normally run inside WidgetKit's process and rely on system-provided padding and backgrounds.
  236. ```swift
  237. @MainActor
  238. static func renderWidget(
  239. name: String,
  240. size: CGSize,
  241. cornerRadius: CGFloat? = nil,
  242. @ViewBuilder content: () -> some View
  243. ) {
  244. let isAccessory = size.height <= 80
  245. let radius = cornerRadius ?? (isAccessory ? 8 : 22)
  246. let contentPadding: CGFloat = isAccessory ? 0 : 16
  247. let view = content()
  248. .padding(contentPadding)
  249. .frame(width: size.width, height: size.height)
  250. .background(theme.background)
  251. .clipShape(RoundedRectangle(cornerRadius: radius, style: .continuous))
  252. .environment(\.colorScheme, .light)
  253. let renderer = ImageRenderer(content: view)
  254. renderer.scale = 3
  255. renderer.isOpaque = false
  256. renderer.proposedSize = .init(width: size.width, height: size.height)
  257. guard let image = renderer.uiImage else { return }
  258. MarketingCapture.writePNG(image, name: name, subfolder: "elements")
  259. }
  260. // Standard iPhone widget sizes (points, iPhone 14-17 size class)
  261. enum WidgetSize {
  262. static let small = CGSize(width: 170, height: 170)
  263. static let medium = CGSize(width: 364, height: 170)
  264. static let large = CGSize(width: 364, height: 382)
  265. static let accessoryCircular = CGSize(width: 76, height: 76)
  266. static let accessoryRectangular = CGSize(width: 172, height: 76)
  267. static let accessoryInline = CGSize(width: 257, height: 26)
  268. }
  269. // Usage:
  270. renderWidget(name: "widget-pulse-small", size: WidgetSize.small) {
  271. PulseSmallView(entry: PulseEntry(
  272. date: Date(),
  273. count: 2,
  274. streak: 5,
  275. lastItemName: "Morning Routine"
  276. ))
  277. }
  278. ```
  279. ### Charts / standalone views
  280. Any SwiftUI view can be rendered as an element. Wrap it the same way — explicit size, background, corner clip:
  281. ```swift
  282. @MainActor
  283. static func renderChart() {
  284. let chart = MyChartView(values: ChartData.sample)
  285. .frame(width: 420, height: 420)
  286. .background(theme.background)
  287. .clipShape(RoundedRectangle(cornerRadius: 32, style: .continuous))
  288. let renderer = ImageRenderer(content: chart)
  289. renderer.scale = 3
  290. renderer.isOpaque = false
  291. renderer.proposedSize = .init(width: 420, height: 420)
  292. guard let image = renderer.uiImage else { return }
  293. MarketingCapture.writePNG(image, name: "chart-overview", subfolder: "elements")
  294. }
  295. ```
  296. ## Known Gotchas
  297. These are all real bugs that bit a real project. Treat this list as load-bearing.
  298. ### 1. Live Activities persist across app launches
  299. 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.
  300. 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.
  301. ### 2. Don't re-seed on every locale
  302. 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:
  303. ```swift
  304. contentVM.fetchItems()
  305. if contentVM.allItems.isEmpty {
  306. DemoDataSeeder.seedIfEmpty(in: modelContext)
  307. contentVM.fetchItems()
  308. }
  309. ```
  310. ### 3. ViewModels that setup before the seed hold stale snapshots
  311. 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.
  312. ### 4. Setting a trigger binding to nil does NOT dismiss a sheet
  313. 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.
  314. Fix: broadcast a dismiss signal via NotificationCenter, and have the presented view listen:
  315. ```swift
  316. // MarketingCapture.swift
  317. static let dismissSheetNotification = Notification.Name("MarketingCapture.dismissSheet")
  318. // In presented view body
  319. .onReceive(NotificationCenter.default.publisher(for: MarketingCapture.dismissSheetNotification)) { _ in
  320. dismiss()
  321. }
  322. ```
  323. 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.
  324. ### 5. NavigationPath can't be popped from outside
  325. 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.
  326. ### 6. Widget views normally live in the extension target only
  327. 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:
  328. - **(a)** Add the widget view files (and their entry types and any shared helpers) to the main app target's membership. If the project uses synchronized folder groups, this means editing `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.
  329. - **(b)** Skip widget rendering from the capture harness and let the user do them manually.
  330. You'll also need to exclude `<App>WidgetBundle.swift` from the main app target (it has `@main` and conflicts with the app's `@main`).
  331. ### 7. `ImageRenderer` + `ProgressView(value:total:)` = prohibited symbol
  332. Without 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.
  333. ### 8. `.containerBackground(for: .widget)` is a no-op outside widget context
  334. When 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:
  335. ```swift
  336. content()
  337. .padding(16) // widget container normally provides this
  338. .frame(width: size.width, height: size.height)
  339. .background(theme.background)
  340. .clipShape(RoundedRectangle(cornerRadius: 22, style: .continuous))
  341. ```
  342. Home-screen widget corner radius on iPhone: ~22pt. Lock-screen accessory radius: ~8pt.
  343. ### 9. iPhone 8 Plus is gone on iOS 26
  344. 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.
  345. ### 10. Locale launch arguments
  346. 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`.
  347. ### 11. SwiftUI animations in ImageRenderer
  348. `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:
  349. ```swift
  350. try? await Task.sleep(for: .milliseconds(500)) // let onAppear animations finish
  351. let renderer = ImageRenderer(content: view)
  352. ```
  353. ## Output Layout
  354. ```
  355. marketing/
  356. <locale>/ e.g. en, de, es, fr, ja
  357. 01-home.png
  358. 02-<screen>.png
  359. ...
  360. NN-<screen>.png
  361. elements/
  362. card-<name>.png
  363. widget-<family>-<size>.png
  364. chart-<name>.png
  365. ```
  366. Put `marketing/` in `.gitignore`. These are outputs, not source.
  367. ## Verification Checklist
  368. Before declaring the capture pipeline done, verify:
  369. - [ ] All locales produced N files (where N = screens + elements)
  370. - [ ] File sizes differ between locales (confirms translations actually render — if `en/settings.png` and `de/settings.png` are byte-identical, locale switching didn't take effect)
  371. - [ ] Read 2-3 screens visually for the primary locale and confirm they show the expected content
  372. - [ ] Read the same screens for at least one other locale and confirm localized strings are present
  373. - [ ] Read at least one widget render and one card render to verify backgrounds and corners look right
  374. - [ ] No screenshot shows a screen from a *different* step (the most common bug — an undismissed sheet from the previous step)
  375. ## Templates
  376. - `templates/MarketingCapture.swift.template` — skeleton of the capture file with step-based coordinator. Reference the body of this skill for the patterns to apply.
  377. - `templates/capture-marketing.sh.template` — skeleton of the shell script. Replace the bundle ID, scheme name, and simulator name for each project.
README.md · README · 243 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. [![bloom-banner-01-light-tags-1500x500](https://github.com/user-attachments/assets/31139b9d-1b89-44e8-b563-5bb7ba150b7b)](https://bloom.parthjadhav.com)
  2. # iOS Marketing Capture
  3. 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.
  4. #### Built for and used by Bloom - https://apps.apple.com/us/app/bloom-coffee-shelf-recipe/id6759914524
  5. ## What it does
  6. - Adds a `#if DEBUG`-gated capture system to your app target — zero production footprint
  7. - Seeds deterministic demo data so every screenshot looks populated and polished
  8. - Navigates to each screen programmatically via a step-based coordinator
  9. - Snapshots the full window including status bar, safe area, and presented sheets
  10. - Renders isolated elements (cards, widgets, charts) via `ImageRenderer` at 3x with transparency
  11. - Loops every locale automatically — one build, N relaunches with `-AppleLanguages`
  12. - Works with any SwiftUI navigation pattern: `TabView`, `NavigationStack`, `NavigationSplitView`
  13. ## Install
  14. ### Using npx skills (recommended)
  15. ```bash
  16. npx skills add ParthJadhav/ios-marketing-capture
  17. ```
  18. This works with Claude Code, Cursor, Windsurf, OpenCode, Codex, and [40+ other agents](https://github.com/vercel-labs/skills#available-agents).
  19. Install globally (available across all projects):
  20. ```bash
  21. npx skills add ParthJadhav/ios-marketing-capture -g
  22. ```
  23. Install for a specific agent:
  24. ```bash
  25. npx skills add ParthJadhav/ios-marketing-capture -a claude-code
  26. ```
  27. ### Manual (git clone)
  28. ```bash
  29. git clone https://github.com/ParthJadhav/ios-marketing-capture ~/.claude/skills/ios-marketing-capture
  30. ```
  31. ## Usage
  32. Once installed, the skill triggers automatically when you ask your agent to:
  33. - Capture marketing screenshots for my iOS app
  34. - Generate locale screenshots across all languages
  35. - Render my widgets as isolated PNGs
  36. - Automate App Store screenshot capture
  37. Or just tell the agent what you need:
  38. ```
  39. > Capture marketing screenshots for my app across all locales
  40. ```
  41. The agent will ask you about your screens, elements, locales, device, appearance, and seed data before writing any code.
  42. ## Example prompts
  43. These are good starting prompts because they provide context while still leaving room for the skill to guide the process.
  44. ### Coffee app
  45. ```text
  46. Capture marketing screenshots for my coffee tracking app.
  47. I want Home, Shelf, Coffee Detail, Brew Timer, and Settings.
  48. Also render coffee cards and all my widgets as isolated elements.
  49. Capture across en, de, es, fr, ja.
  50. ```
  51. ### Habit tracker
  52. ```text
  53. Generate locale screenshots for my habit tracker app.
  54. I need the dashboard, habit detail, streak view, and settings.
  55. Light mode only, iPhone 17 simulator.
  56. All 5 locales in my Localizable.xcstrings.
  57. ```
  58. ### Finance app
  59. ```text
  60. Capture marketing assets for my finance app.
  61. I want the overview, transaction list, budget detail, and charts.
  62. Render the spending chart and category cards as isolated elements.
  63. English and German only.
  64. ```
  65. ### Fitness app with widgets
  66. ```text
  67. Automate App Store screenshot capture for my workout app.
  68. Capture the main dashboard, workout detail mid-session, and history.
  69. Render all my WidgetKit widgets (small, medium, lock screen) as isolated PNGs.
  70. ```
  71. ## Better prompt tips
  72. - List the exact screens you want captured by tab name or navigation path
  73. - Mention any components you want rendered independently (cards, widgets, charts)
  74. - Specify locales explicitly or say "all locales in my xcstrings"
  75. - Say which simulator and iOS version you want
  76. - Mention if any screen needs to be captured in a non-default state (e.g. timer mid-countdown)
  77. - Say light only, dark only, or both
  78. ## How it works
  79. ### In-app capture mode, not XCUITest
  80. The skill uses an in-app capture approach instead of XCUITest / Fastlane:
  81. - **No test target surgery** — many projects have none, and adding one means fragile pbxproj edits
  82. - **Direct access to everything** — ViewModels, SwiftData, `ImageRenderer`, `UIWindow.drawHierarchy`
  83. - **Faster** — `xcodebuild build` once, then `simctl launch` per locale (no test-bundle overhead)
  84. - **Element renders require it** — `ImageRenderer` on widget views must run inside the app process
  85. ### Step-based coordinator
  86. Each screenshot is a self-contained `CaptureStep`:
  87. ```swift
  88. struct CaptureStep {
  89. let name: String // "01-home"
  90. let navigate: @MainActor () -> Void // put the app in the right state
  91. let settle: Duration // wait for animations
  92. let cleanup: (@MainActor () -> Void)? // tear down before next step
  93. }
  94. ```
  95. The coordinator is a simple loop — no hardcoded screen sequences. The agent composes steps for your specific navigation architecture.
  96. ### Navigation patterns
  97. The skill covers three navigation architectures:
  98. | Pattern | How steps drive it |
  99. |---------|-------------------|
  100. | `TabView(selection:)` | `setTab(index)` |
  101. | `NavigationStack` + router | `router.push(.route)` / `router.popToRoot()` |
  102. | `NavigationSplitView` | Set sidebar + detail selection bindings |
  103. ### Element rendering
  104. Isolated components are rendered via `ImageRenderer` at 3x scale with natural background inside rounded corners and transparency outside:
  105. ```swift
  106. MarketingElementHarness.renderElement(
  107. name: "card-morning-blend",
  108. width: 380,
  109. cornerRadius: 20,
  110. background: theme.background
  111. ) {
  112. CoffeeCard(coffee: coffee, theme: theme)
  113. .padding(.horizontal, 16)
  114. .padding(.vertical, 12)
  115. }
  116. ```
  117. Widget rendering handles the quirks of rendering WidgetKit views outside the widget process (missing `containerBackground`, missing padding, `ProgressView` rendering bugs).
  118. ## What gets generated
  119. The skill guides the agent to create:
  120. ```
  121. YourApp/
  122. ├── Debug/
  123. │ └── MarketingCapture.swift # Capture system (DEBUG-only)
  124. ├── ContentView.swift # Modified — DEBUG hook for seed + coordinator
  125. ├── Views/.../TimerView.swift # Modified — primed state hooks (if needed)
  126. scripts/
  127. └── capture-marketing.sh # Build + install + per-locale loop
  128. ```
  129. ### Output layout
  130. ```
  131. marketing/
  132. en/
  133. 01-home.png
  134. 02-detail.png
  135. 03-settings.png
  136. elements/
  137. card-morning-blend.png
  138. widget-pulse-small.png
  139. chart-cupping.png
  140. de/
  141. ...
  142. es/
  143. ...
  144. ```
  145. ## Known gotchas
  146. The skill documents 11 real bugs discovered during development. These are all baked into the skill's guidance so the agent avoids them automatically:
  147. | # | Gotcha | What happens |
  148. |---|--------|--------------|
  149. | 1 | Live Activities persist across launches | Next locale crashes on stale SwiftData references |
  150. | 2 | Re-seeding per locale | CloudKit sync churn causes crashes |
  151. | 3 | VMs setup before seed | Hold stale empty snapshots |
  152. | 4 | Setting trigger binding to nil | Doesn't dismiss fullScreenCover — wrong screenshot |
  153. | 5 | NavigationPath can't be popped externally | Must capture clean stack before pushed detail |
  154. | 6 | `membershipExceptions` is an INCLUSION list | Widget target membership goes backwards |
  155. | 7 | `ImageRenderer` + `ProgressView` | Renders as prohibited symbol without explicit style |
  156. | 8 | `.containerBackground` outside WidgetKit | No-op — widget renders have no background |
  157. | 9 | iPhone 8 Plus gone on iOS 26 | Legacy 6.5" simulator unavailable |
  158. | 10 | Locale launch argument format | Parens are mandatory: `(xx)` not `xx` |
  159. | 11 | SwiftUI animations in ImageRenderer | Captures frame 0, not the animated state |
  160. ## Pairs well with
  161. Use [app-store-screenshots](https://github.com/ParthJadhav/app-store-screenshots) as a post-processing step to composite the captured PNGs into Apple-style marketing pages with device mockups, headlines, and gradients.
  162. ## Requirements
  163. - Xcode 16+ (synchronized folder groups support)
  164. - iOS 17+ deployment target (for `ImageRenderer`, `@Observable`)
  165. - A simulator runtime matching your target iOS version
  166. - Python 3 (used by the shell script for JSON parsing)
  167. ## Contributing
  168. Contributions are welcome, especially around:
  169. - Support for additional navigation patterns
  170. - New gotcha documentation from real projects
  171. - Cross-agent compatibility improvements
  172. - Clearer docs and onboarding
  173. ## License
  174. MIT
  175. ## Author
  176. Created by [Parth Jadhav](https://www.parthjadhav.com/).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.