Gemini CLI + SwiftUI
In-app feedback for SwiftUI, fixed by Gemini CLI
You are building a SwiftUI app with Gemini CLI. Gemini CLI is Google's terminal agent. It runs shell commands through its own tool and loads MCP servers from a settings file, so Nitpick fits next to your code like any other server.
1. Paste one prompt into Gemini CLI
Run gemini in your project folder, choose Sign in with Google when it asks, and paste the prompt.
Add Nitpick feedback to this app. Fetch https://nitpickhq.com/install.md and follow every step.Gemini CLI follows install.md. nitpick login opens your browser, where you create an account and start the subscription, and Gemini CLI waits for that before it adds the component.
By default every shell command the agent asks for needs your approval. You can allow it once, allow it always for the rest of the session, or deny it. Starting with gemini --sandbox adds a sandbox on top.
2. What lands in your SwiftUI code
Roughly this. Gemini CLI 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 Gemini CLI the MCP server
Gemini CLI lists MCP servers under mcpServers in its settings file. Use .gemini/settings.json in the project, or ~/.gemini/settings.json for your user.
{
"mcpServers": {
"nitpick": { "command": "npx", "args": ["-y", "@nitpickhq/cli", "mcp"] }
}
}If the file already has settings, add only the mcpServers entry. An optional timeout in milliseconds can sit next to command and args. As an alternative, gemini mcp add nitpick npx -y @nitpickhq/cli@latest mcp writes the entry for you (project scope by default, -s user for your user).
Type /mcp in a running session. It lists the configured servers, their connection status and the tools they offer.
4. Build and run in the simulator with Gemini CLI
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.myappExpect a prompt for each different command in the build: listing schemes, building, booting the simulator, installing and launching. Choose Allow always on each one and the rest of the session runs without more questions.
5. Let Gemini CLI fix the reports
Start gemini in your project and ask it to check Nitpick for open feedback, fix what it can and resolve the reports. 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 Gemini CLI
- Install it with
npm install -g @google/gemini-cli, then rungeminiin any project folder. - Type
!before a command to run it in your own shell without the agent, for example!npx -y @nitpickhq/cli@latest feedback list. /mcpshows the status of every server and the tools it offers, so use it first when a tool seems missing.
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
- Gemini CLI with Expo
- Claude Code with SwiftUI
- Codex with SwiftUI
- Cursor 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