Codex + SwiftUI
In-app feedback for SwiftUI, fixed by Codex
You are building a SwiftUI app with Codex. Codex works from your repository and your terminal, so the same one-line prompt installs the component and later pulls reports through MCP.
1. Paste one prompt into Codex
Run codex in your project folder, sign in on first launch, and paste the prompt into the terminal interface.
Add Nitpick feedback to this app. Fetch https://nitpickhq.com/install.md and follow every step.Codex follows install.md. nitpick login opens your browser, where you create an account and start the subscription, and Codex waits for that before it adds the component.
Codex's default Auto preset reads files, edits and runs commands inside the working directory without asking. It asks before it edits outside the workspace or runs a command that needs network access, because network access is off by default in that sandbox.
2. What lands in your SwiftUI code
Roughly this. Codex writes it, you review it.
- Add the Swift package in Xcode with File > Add Package Dependencies, and put the Nitpick product in your app target.
- Check that the deployment target is iOS 17.0 or newer.
- Call Nitpick.configure once at launch, then name screens and elements.
import SwiftUI
import Nitpick
@main
struct MyApp: App {
init() { Nitpick.configure(appKey: "npk_YOUR_PUBLIC_KEY") }
var body: some Scene {
WindowGroup { RootView().nitpick() }
}
}
// Name what users may point at
Button("Start", action: start)
.nitpickElement("Home/StartButton")Needs iOS 17 or newer. The Swift package ships its own privacy manifest. Details in Install for SwiftUI.
3. Give Codex the MCP server
Codex adds a stdio server with a command, or you write the same thing by hand as a table in its TOML configuration.
codex mcp add nitpick -- npx -y @nitpickhq/cli mcp[mcp_servers.nitpick]
command = "npx"
args = ["-y", "@nitpickhq/cli", "mcp"]Global settings live in ~/.codex/config.toml. A project can carry its own .codex/config.toml with the same table, which Codex reads only when you trust the project.
Run codex mcp list for a summary, or type /mcp in the terminal interface to see the active servers.
4. Build and run in the simulator with Codex
xcodebuild -list shows the schemes and builds one for a simulator, and xcrun simctl boots, installs and launches the app. Your scheme, simulator and bundle identifier will differ.
xcodebuild -list
xcodebuild -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 16' -derivedDataPath build build
xcrun simctl boot "iPhone 16"
xcrun simctl install booted build/Build/Products/Debug-iphonesimulator/MyApp.app
xcrun simctl launch booted com.example.myappXcode writes build products to DerivedData in your home folder unless told otherwise, which is outside the workspace. Ask Codex to build with -derivedDataPath pointing into the project, and expect an approval prompt when a remote Swift package has to be fetched, since that needs the network.
5. Let Codex fix the reports
Ask Codex to list the open Nitpick reports for the app, then to fix them one by one and resolve each. It calls list_feedback, reads each report with its screenshot through get_feedback, and finds the code. An element name such as checkout.pay_button leads straight to the line that says .nitpickElement("checkout.pay_button"), and a screen name leads to the matching .nitpickScreen call. When the fix is done it calls resolve_feedback.
Working with Codex
- On first launch Codex asks you to sign in with ChatGPT or another method it offers.
- Codex lets you set a default approval behavior for each MCP server, with the values auto, prompt, writes and approve.
- A project can carry its own .codex/config.toml, so the server entry can live next to your code. Codex reads it only in projects you trust.
Good to know for SwiftUI
- The tab and panel live in their own windows above your app, so they also show over sheets and full screen covers.
- Password fields are covered in the screenshot where iOS allows it. Everything else sensitive needs .nitpickMask().
$9 a month per account. Unlimited apps.
Get startedRelated
- Codex with Expo
- Claude Code with SwiftUI
- Cursor with SwiftUI
- Gemini CLI with SwiftUI
- Add in-app feedback to a SwiftUI app
- In-app feedback with a screenshot in SwiftUI
- Collect bug reports from users in SwiftUI
- MCP reference