Skip to content

GitHub Copilot + SwiftUI

In-app feedback for SwiftUI, fixed by GitHub Copilot

You are building a SwiftUI app with GitHub Copilot. GitHub Copilot's agent mode in VS Code runs tools and terminal commands from the Chat view. MCP servers come from a mcp.json file in your workspace.

1. Paste one prompt into GitHub Copilot

Open the Chat view in VS Code, choose Agent from the agent picker, and paste the prompt into the chat input.

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

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

The agent runs shell commands in an integrated terminal in VS Code through its built-in terminal tool. Read-only commands run automatically; other commands, such as xcodebuild or npx expo install, show a confirmation dialog where you allow them once, for the session or for the workspace. You can expand the dialog to see the exact command first.

2. What lands in your SwiftUI code

Roughly this. GitHub Copilot 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 GitHub Copilot the MCP server

VS Code reads MCP servers from .vscode/mcp.json. The file uses a servers object, and a stdio server states its type.

.vscode/mcp.json
{
  "servers": {
    "nitpick": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@nitpickhq/cli", "mcp"]
    }
  }
}

The command palette has MCP: Add Server for a guided setup and MCP: Open User Configuration for a file that applies to all your workspaces.

Send a chat message in agent mode. VS Code asks you to confirm that you trust the server, and then the agent discovers its tools and offers them in chat.

4. Build and run in the simulator with GitHub Copilot

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

Build and simulator commands run in the integrated terminal, so you see the xcodebuild output scroll by in the editor. Read-only commands run without a dialog; xcodebuild and simctl show one, and you can allow them for the session or the workspace.

5. Let GitHub Copilot fix the reports

In agent mode, ask Copilot to use the Nitpick tools: list open feedback, fix each report 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 GitHub Copilot

Good to know for SwiftUI

$9 a month per account. Unlimited apps.

Get started

Related

Sources