use-cases/native-ios-apps.md +136 −0 added
1---
2name: Build for iOS
3tagline: Use Codex to scaffold, build, and debug SwiftUI apps for iPhone and iPad.
4summary: Use Codex to scaffold iOS SwiftUI projects, keep the build loop
5 CLI-first with `xcodebuild` or Tuist, and add XcodeBuildMCP or focused SwiftUI
6 skills when the work gets deeper.
7skills:
8 - token: build-ios-apps
9 url: https://github.com/openai/plugins/tree/main/plugins/build-ios-apps
10 description: Build or refactor SwiftUI UI, adopt modern iOS patterns such as
11 Liquid Glass, audit runtime performance, and debug apps on simulators with
12 XcodeBuildMCP-backed workflows.
13bestFor:
14 - Greenfield iOS SwiftUI apps where you want Codex to scaffold the app and
15 build loop from scratch
16 - Existing iPhone and iPad projects where Codex needs schemes, simulator
17 output, screenshots, or UI automation before the work is done
18 - Teams that want long-running iOS UI tasks to stay agentic and CLI-first
19 instead of depending on the Xcode GUI
20starterPrompt:
21 title: Scaffold the App and Build Loop
22 body: >-
23 Scaffold a starter SwiftUI app and add a build-and-launch script I can wire
24 to a `Build` action in my local environment.
25
26
27 Constraints:
28
29 - Stay CLI-first. Prefer Apple's `xcodebuild`; if a cleaner setup helps,
30 it's okay to use Tuist.
31
32 - If this repo already contains a full Xcode project, use XcodeBuildMCP to
33 list targets, pick the right scheme, build, launch, and capture screenshots
34 while you iterate.
35
36 - Reuse existing models, navigation patterns, and shared utilities when they
37 already exist.
38
39 - Keep the app focused on iPhone and iPad unless I explicitly ask for a
40 shared Apple-platform implementation.
41
42 - Use a small trustworthy validation loop after each change, then expand to
43 broader builds only when the narrower check passes.
44
45 - Tell me whether you treated this as a greenfield scaffold or an
46 existing-project change.
47
48
49 Deliver:
50
51 - the app scaffold or requested feature slice
52
53 - a small build-and-launch script with the exact commands
54
55 - the smallest relevant validation steps you ran
56
57 - the exact scheme, simulator, and checks you used
58relatedLinks:
59 - label: Model Context Protocol
60 url: /codex/mcp
61 - label: Agent skills
62 url: /codex/skills
63techStack:
64 - need: UI framework
65 goodDefault: "[SwiftUI](https://developer.apple.com/documentation/swiftui/)"
66 why: The fastest way to prototype views, navigation, and shared state for iPhone
67 and iPad while keeping the UI code readable.
68 - need: Build tooling
69 goodDefault: xcodebuild or [Tuist](https://docs.tuist.dev/)
70 why: Both keep the native build loop in the terminal instead of depending on the
71 Xcode GUI.
72 - need: Project automation
73 goodDefault: "[XcodeBuildMCP](https://www.xcodebuildmcp.com/)"
74 why: A strong option once you need Codex to inspect schemes and targets, launch
75 the app, capture screenshots, and keep iterating without leaving the
76 agentic loop.
77 - need: Distribution tooling
78 goodDefault: "[App Store Connect CLI](https://asccli.sh/)"
79 why: Keep your agent fully in the loop and send your app build directly to the
80 App Store.
81---
82
83## Scaffold the app and build loop
84
85For greenfield work, start with plain prompting. Ask Codex to scaffold a starter iOS SwiftUI app and write a small build-and-launch script you can wire to a `Build` action in a [local environment](https://developers.openai.com/codex/app/local-environments).
86
87Keep the loop CLI-first. Apple's `xcodebuild` can list schemes and handle build, test, archive, `build-for-testing`, and `test-without-building` actions from the terminal, which lets Codex stay in an agentic loop instead of bouncing into the Xcode GUI.
88
89If you want a cleaner project generator and you're comfortable with third-party tooling, [Tuist](https://tuist.dev/) is a good next step. It can generate and build Xcode projects without needing the GUI, while still letting Codex build and launch the app from the terminal.
90
91Use [XcodeBuildMCP](https://www.xcodebuildmcp.com/) once you're inside a full Xcode project and need deeper automation. That's when schemes, targets, simulator control, screenshots, logs, and UI interaction matter enough that plain shell commands stop being the whole story.
92
93## Leverage skills
94
95For the first pass, you often don't need a skill or MCP server. Add skills once the work gets specialized or you want stronger SwiftUI conventions baked into the run.
96
97- [SwiftUI expert](https://github.com/AvdLee/SwiftUI-Agent-Skill) is a strong general-purpose SwiftUI skill with a lot of best practices already baked in.
98- [SwiftUI Pro](https://github.com/twostraws/SwiftUI-Agent-Skill/blob/main/swiftui-pro/SKILL.md) is a broad SwiftUI review skill for modern APIs, maintainability, accessibility, and performance.
99
100- [Liquid Glass expert](https://github.com/Dimillian/Skills/blob/main/swiftui-liquid-glass/SKILL.md) helps Codex adopt the new iOS 26 Liquid Glass APIs and tune custom components so they fit the latest system design.
101- [SwiftUI performance](https://github.com/Dimillian/Skills/blob/main/swiftui-performance-audit/SKILL.md) helps when a feature feels slow or a SwiftUI view update path looks suspicious. It scans for common SwiftUI mistakes and produces a prioritized report of what to fix and where the biggest gains are.
102- [Swift concurrency expert](https://github.com/Dimillian/Skills/blob/main/swift-concurrency-expert/SKILL.md) helps when cryptic errors and compiler warnings start fighting the change you want to make. On GPT-5.4, you may need it less often, but it's still useful when Swift concurrency diagnostics get noisy.
103- [SwiftUI view refactor](https://github.com/Dimillian/Skills/blob/main/swiftui-view-refactor/SKILL.md) helps keep files smaller and make SwiftUI code more consistent across the repo.
104- [SwiftUI patterns](https://github.com/Dimillian/Skills/blob/main/swiftui-ui-patterns/SKILL.md) helps reach for predictable `@Observable` and `@Environment` architecture patterns as the app grows.
105
106To learn more about how to install and use skills, see our [skills documentation](https://developers.openai.com/codex/skills).
107
108## Iterate
109
110Once you have a first pass working, or if you're starting from an existing project, you can start iterating on the UI or behavior.
111
112For this part, be specific about what you want to change and how you want to change it.
113
114Make that prompting layer explicit: tell Codex whether it's working in a greenfield repo or an existing Xcode project, which iOS devices or deployment targets must keep working, and what validation loop you expect.
115
116### Example prompt
117
118For example, if you want to add a feature to an existing app, you can ask Codex for a change like this:
119
120## Practical tips
121
122### Start with basics
123
124Start with plain prompting for greenfield work. Ask Codex to scaffold a starter SwiftUI app and write a small build-and-launch script you can wire to a `Build` action in a [local environment](https://developers.openai.com/codex/app/local-environments). For that first pass, you often don't need any skill or MCP server.
125
126### Use a small trustworthy validation loop
127
128After each change, tell Codex to run the narrowest command that actually proves the contract you touched. Expand to broader builds later. This keeps Codex fast without pretending a full app build is required for every edit.
129
130### Keep the loop CLI-first
131
132Keep the loop CLI-first. Apple's `xcodebuild` tool can list schemes and run build, test, archive, `build-for-testing`, and `test-without-building` actions from the terminal, which lets Codex stay in an agentic loop instead of bouncing into the Xcode GUI.
133
134### Leverage XcodeBuildMCP
135
136Use XcodeBuildMCP as soon as you are inside a full Xcode project and need deeper automation. That's the point where schemes, targets, simulator control, screenshots, logs, and UI interaction matter enough that plain shell commands stop being the whole story.