Skip to content

Cursor + SwiftUI

In-app feedback for SwiftUI, fixed by Cursor

You are building a SwiftUI app with Cursor. Cursor reads MCP servers from a small JSON file, so adding Nitpick is a paste. The agent in the side pane can then call the tools while it edits your code.

1. Paste one prompt into Cursor

Open your project in Cursor, open the Agent side pane with Cmd+I, and paste the prompt there.

Add Nitpick feedback to this app. Fetch https://nitpickhq.com/install.md and follow every step.

Cursor follows install.md. nitpick login opens your browser, where you create an account and start the subscription, and Cursor waits for that before it adds the component.

Cursor runs the agent's shell commands in the terminal. Your Run Mode decides what happens: in the default Auto-review mode, allowlisted commands run immediately and other shell commands run in the sandbox when possible. The other modes are Allowlist and Run Everything.

2. What lands in your SwiftUI code

Roughly this. Cursor writes it, you review it.

  1. Add the Swift package in Xcode with File > Add Package Dependencies, and put the Nitpick product in your app target.
  2. Check that the deployment target is iOS 17.0 or newer.
  3. Call Nitpick.configure once at launch, then name screens and elements.
App.swift
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 Cursor the MCP server

Cursor takes MCP servers from an mcp.json file. The command has to be on your system path, which npx is once Node is installed.

.cursor/mcp.json
{
  "mcpServers": {
    "nitpick": { "command": "npx", "args": ["-y", "@nitpickhq/cli", "mcp"] }
  }
}

Put the file in .cursor/ inside your project for this project only, or in ~/.cursor/mcp.json to have it everywhere.

Open the Customize panel in the sidebar. It lists every configured MCP server and lets you switch each one on or off without deleting it.

4. Build and run in the simulator with Cursor

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.

terminal
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.myapp

Builds with xcodebuild write outside the project unless you pass -derivedDataPath. Check your Run Mode and add the build commands to your allowlist before the first build, so the agent is not stopped halfway.

5. Let Cursor fix the reports

In the agent chat, ask it to use the Nitpick tools: list open feedback, fix it and mark it resolved. 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 Cursor

Good to know for SwiftUI

$9 a month per account. Unlimited apps.

Get started

Related

Sources