blake@xcode:~/Projects$ cat ios-agent-development.md

Building iOS Apps with AI Agents: The Practitioner's Guide

# Build iOS apps faster with AI agents. Claude Code, Codex CLI, Xcode 27 agents, MCP, CLAUDE.md patterns, hooks, lessons from 8 apps.

author: words: 33083 read_time: 165m updated: 2026-11-25 00:00

Part 1 of iOS with Agents

$ less ios-agent-development.md

TL;DR: Three agent runtimes now ship code for iOS: Claude Code CLI with MCP, Codex CLI with MCP, and Xcode’s native Intelligence agents, which run Claude Agent, Codex, Google Gemini, Google Antigravity, or any Agent Client Protocol (ACP) agent, with GitHub Copilot added in the Xcode 27.3 beta.171827 Two MCP servers give agents structured access to builds, tests, simulators, and debugging: MobileBuildMCP (82 tools; the project was named XcodeBuildMCP until September 23, 2026) and Apple’s xcrun mcpbridge (20 tools in Xcode 26.3, 54 on Xcode 27.2).26 This guide covers real CLAUDE.md patterns, hook configurations, and honest assessments of what works and what breaks, drawn from 8 production iOS apps totaling 293 Swift files.46 Agents excel at SwiftUI views, SwiftData models, refactoring, and build error diagnosis. They fail at hand-editing .pbxproj project files, code signing, and visual debugging. The gap between “agent writes Swift” and “agent ships an iOS app” is bridged by configuration, not by prompting. iOS 27 and Xcode 27 shipped on September 14, 2026. Xcode 27.2 (27B52, Swift 6.4) is the current stable toolchain and needs an Apple silicon Mac on macOS Tahoe 26.6 or later.1828 iOS 27 adds agent-relevant frameworks (Foundation Models tool-calling control, App Intents background execution, the new Core AI and Evaluations frameworks) worth naming in your agent’s context, since a model trained before June 2026 will not know them.

I’ve built 8 iOS apps with AI coding agents. Not prototypes — apps in the App Store, with HealthKit integrations, Metal shaders, SpriteKit physics, iCloud sync, Live Activities, Game Center leaderboards, and multi-platform targets spanning iOS, watchOS, and tvOS. Every line of Swift in these apps was either written by an agent and reviewed by me, or written by me and refactored by an agent. By my estimate, agents handled the bulk of the line-level authorship; I handled review, scope, and the parts that require human judgment (visual polish, signing, performance tuning, App Store submission).

This guide is the reference I wish existed when I started. It covers the full stack: which agent runtime to use, how to configure MCP servers for structured build access, what to put in your CLAUDE.md, which hooks prevent the agent from destroying your Xcode project, and — critically — where agents fail and you need to take the wheel.

Key Takeaways

For iOS developers new to AI agents:

  • Start with Claude Code CLI + MobileBuildMCP. It is the most mature runtime with the deepest MCP tool coverage. Install two commands, add a CLAUDE.md to your project, and the agent can build, test, and debug without you copying error messages.
  • Never let an agent modify .pbxproj. This is the single most important rule. A PreToolUse hook that blocks writes to .pbxproj and .xcodeproj/ will save you hours of recovery.
  • Your CLAUDE.md is the agent’s onboarding document. Hours spent on it pay back across every agent session that touches the project.

For experienced agent users adding iOS to their workflow:

  • MCP transforms the iOS build loop. Before MCP, agents wrote Swift but could not verify it compiled. With MobileBuildMCP, the agent writes code, builds it, reads structured errors, fixes them, and runs tests — autonomously.
  • Three runtimes serve different needs. Claude Code CLI for deep agentic sessions, Codex CLI for headless batch work, and Xcode’s own agents — which stopped being an inline-fix tool in Xcode 27, where they gained plug-ins, MCP servers, and the ability to drive simulators.22
  • Hook infrastructure carries over. Your existing PostToolUse formatters and PreToolUse blockers work identically for iOS projects with minor path adjustments.

For team leads evaluating AI-assisted iOS development:

  • Agent effectiveness scales with project documentation, not project size. A 63-file app with a detailed CLAUDE.md produces better agent output than a 14-file app with none.
  • The .pbxproj boundary is non-negotiable. Agents cannot reliably edit Xcode project files. Your workflow must account for manual file addition to Xcode targets. Xcode 27.2’s JSON project format (.xcproj) and the project tools in Apple’s MCP server are the first Apple-provided routes around it, and neither is something I have shipped with yet (see What Agents Do Poorly).
  • Honest ROI: agents handle the implementation bulk on well-documented projects — visible in the 15-file TV app shipped in 3 hours of agent-assisted work (case study below). The remaining work — visual polish, signing, performance tuning, App Store submission — requires human judgment.

Choose Your Path

What you need Go here
Set up MCP for the first time MCP Setup: The Complete Configuration — install both servers, verify, configure agents
Write a CLAUDE.md for your iOS project CLAUDE.md Patterns for iOS Projects — real examples from 8 apps
Compare the three agent runtimes Three Agent Runtimes for iOS — Claude Code vs. Codex vs. Xcode native
Understand what agents can and cannot do What Agents Do Well and What Agents Do Poorly
Set up hooks for iOS development Hooks for iOS Development — format-on-save, .pbxproj protection, lint and auto-build
Deep reference (this page) Keep reading — everything from setup to advanced patterns

How to Use This Guide

This is a 3,000+ line reference. Start where your experience level fits:

Experience Start Here Then Explore
New to iOS + agents Prerequisites → MCP Setup → Your First Agent Session CLAUDE.md Patterns, What Works/Doesn’t
iOS developer, new to agents Three Runtimes → MCP Setup → CLAUDE.md Hooks, Architecture Patterns
Agent user, new to iOS Architecture Patterns → What Agents Do Poorly → CLAUDE.md Framework-Specific Context, Advanced Workflows
Experienced with both Advanced Workflows → Hooks → Multi-Platform Patterns Runtime Comparison, The Portfolio

Table of Contents

  1. iOS 27 and WWDC 2026: What Your Agent Now Builds With
  2. The Portfolio: 8 Apps, 293 Files
  3. Prerequisites
  4. Three Agent Runtimes for iOS
  5. MCP Setup: The Complete Configuration
  6. CLAUDE.md Patterns for iOS Projects
  7. Your First Agent Session
  8. What Agents Do Well in iOS
  9. What Agents Do Poorly in iOS
  10. Hooks for iOS Development
  11. Architecture Patterns That Work with Agents
  12. Framework-Specific Context
  13. Multi-Platform Patterns
  14. Advanced Workflows
  15. Real-World Case Studies
  16. Project Lifecycle with Agents
  17. Configuring Agent Definitions
  18. Testing Patterns for Agent-Assisted iOS
  19. Context Window Management for iOS Projects
  20. Troubleshooting
  21. Common Agent Mistakes in iOS
  22. The Honest Assessment
  23. FAQ
  24. Quick Reference Card
  25. Changelog
  26. References
Topic Resource
MCP setup for Xcode (shorter blog post) Two MCP Servers Made Claude Code an iOS Build System
Claude Code CLI complete reference Claude Code CLI: The Complete Guide
Codex CLI reference Codex CLI: The Complete Guide
Hook system deep dive Anatomy of a Claw: 84 Hooks as an Orchestration Layer
Agent architecture patterns Agent Architecture Guide
Mac desktop app + Remote Control Claude Code Mac Desktop + Remote Control: A CLI User’s Guide

Apple Ecosystem Series. 21 production posts on SwiftUI apps that integrate with Apple Intelligence, MCP, Foundation Models, Vision, Core ML, and the iOS 26 framework stack. Drawn from Water, Get Bananas, Return, and the rest of the 941 portfolio:

Series hub: Apple Ecosystem Series

Agentic Apple (E4):

Topic Resource
Apple Intelligence’s intent surface App Intents Are Apple’s New API to Your App
MCP server alongside iOS app Two Agent Ecosystems, One Shopping List
When to use which App Intents vs MCP Tools: The Routing Question
On-device LLM as runtime feature vs tooling Foundation Models + Agentic Workflow
Hooks for Apple development Hooks for Apple Development
Cross-process state Single Source of Truth: SwiftData + MCP + iCloud

Frameworks (E2/E3):

Topic Resource
Foundation Models on-device LLM Foundation Models On-Device LLM
Vision framework (CV primitives) Vision Framework: What’s Built In
Core ML inference patterns Core ML On-Device Inference
RealityKit spatial mental model RealityKit and the Spatial Mental Model
SwiftUI internals What SwiftUI Is Made Of
Symbol Effects animation vocabulary Symbol Effects: SwiftUI’s Built-In Animation Vocabulary
Liquid Glass on iOS 26+ Liquid Glass in SwiftUI: Three Patterns

Shipped-code (E1):

Topic Resource
Live Activities state machine Live Activities State Machine
watchOS runtime contract watchOS Runtime Contract
SwiftData schema discipline SwiftData Schema Discipline
HealthKit + SwiftUI patterns HealthKit + SwiftUI on iOS 26
Multi-platform SwiftUI Five Apple Platforms, Three Shared Files
MobileBuildMCP (formerly XcodeBuildMCP) integration Two MCP Servers Made Claude Code an iOS Build System

Synthesis (E5):

Topic Resource
Three surfaces of an iOS app The Three Surfaces of an iOS App
Platform target decisions The Apple Platform Matrix
What I refuse to write about What I Refuse to Write About

iOS 27 and WWDC 2026: What Your Agent Now Builds With

WWDC 2026 (June 8, 2026) introduced iOS 27, and it shipped on September 14, 2026. iOS 27.2.1 (November 9) is the current release, and iOS 27.3 is in beta.28 The agent-development workflow in this guide does not change: you still drive Claude Code, Codex, or Xcode’s Intelligence agents through MCP, you still write a CLAUDE.md, and you still gate the destructive operations with hooks. What changes is the surface area your agent writes against. iOS 27 ships several new agent-relevant frameworks, and the practical move is to point your coding agent at them deliberately, because a model trained before June 2026 will not know they exist. The Foundation Models, App Intents, Core AI, and Evaluations items below are all present in the SDKs that ship with Xcode 27.2.12131415

The agent-relevant iOS 27 surface, each with a deep-dive reference:

  • Foundation Models gained tool-calling control. GenerationOptions.ToolCallingMode lets you steer how aggressively the on-device model calls tools on a per-request basis, and the framework can shift mode after the first call to bound a request’s tool activity. The Vision framework now ships ready-made OCRTool and BarcodeReaderTool you attach to a LanguageModelSession without writing the recognition code. See Foundation Models in iOS 27: Tool-Calling Control.12
  • App Intents broke the 30-second wall. LongRunningIntent (via performBackgroundTask(options:operation:), which requires progress reporting) extends an intent’s background runtime for sync, file work, and on-device inference; SyncableEntity gives an AppEntity a cross-device identity; IndexedEntityQuery lets the system ask your query to repair its Spotlight index. See App Intents in iOS 27: Background, Sync, Spotlight.13
  • Core AI is a new framework for running models on Apple Silicon. It sits below Foundation Models for the cases where you bring your own model rather than use Apple’s system model. See Core AI: Running Models on Apple Silicon.14
  • Evaluations is XCTest for model quality. A new framework (iOS 27, iPadOS 27, macOS 27, visionOS 27, and watchOS 27) for measuring model output quality as part of your test suite, which is the missing piece for shipping AI features an agent helped you build. See Evaluations: XCTest for Model Quality.15
  • SwiftData, HealthKit, and SwiftUI moved too. SwiftData adds observation and history in iOS 27; HealthKit adds workout zones and new types; SwiftUI’s iOS 27 additions are the usual broad surface. See SwiftData in iOS 27, HealthKit in iOS 27, and What’s New in SwiftUI for iOS 27.16

The toolchain for iOS 27 work is Xcode 27. Xcode 27 (27A266a) shipped on September 14, 2026, followed by 27.1 (27A9275) on October 15 and 27.2 (27B52) on October 29. Xcode 27.2 includes Swift 6.4 and the iOS 27.2, iPadOS 27.2, tvOS 27.2, watchOS 27.2, macOS 27.2, and visionOS 27.2 SDKs. Every Xcode 27 release requires macOS Tahoe 26.6 or later, and Xcode 27 installs and runs only on Apple silicon Macs.182829

Release-notes items that matter for agent workflows:18

  • Planning is first class (172857081). Plans appear as editable Markdown next to the conversation, and you approve before the agent proceeds. The beta bug where clicking the “Implement the plan?” bar while the agent was still streaming started an overlapping agent turn (178673449) is listed as fixed in the release.
  • RenderPreview does more. It renders Preview groups (174692209), previews your UI in a different localization (181040291), and returns the display name and line number of the preview it rendered (182215198). In Xcode 27.2 it also returns the available render destinations and lets the caller choose one (186442676).29
  • Localization tools for agents. New MCP tools read, plan, and edit translations in String Catalog files (176376425), and the “Prepare Project for Localization” tool reports String Catalog keys removed because they no longer appear in source (179755385).
  • Agents verify more than iPhone UI. They can verify watchOS apps, “including rotating and pressing the Digital Crown, and pressing the side and Action buttons (Apple Watch Ultra)” (181147968), and tvOS apps, “navigating with the Siri Remote to move focus, select, and go Home, and entering text into focused fields” (183317784). Both close part of the visual-verification gap this guide documents.
  • Address Sanitizer might fail to launch on 27.0 targets when the app was built with Xcode 26.4 or older. Use Xcode 26.5 or later for ASan runs (178072780).
  • An MCP server that runs without an open Xcode workspace is still labeled an early preview. See the section on Apple’s MCP server below.22

MobileBuildMCP works against Xcode 27 simulators too. Its v2.7.0 release (2026-07-23, when the project was still named XcodeBuildMCP) made the UI automation tools work fully with Xcode 27 simulators through Device Hub, including simulator window launching and keyboard controls. Before that release, runtime UI automation was only reliable against Xcode 26 simulators.21

The operator lesson is the same one the rest of this guide makes: the agent writes the code, but you supply the knowledge it lacks. For iOS 27, that means naming these frameworks in your prompt or CLAUDE.md and linking the agent to Apple’s documentation, because the model will otherwise reach for the iOS 26 shape of each API. Everything else in this guide (runtimes, MCP, hooks, the failure modes) holds for iOS 27 work.

The 27.3 Betas: Copilot, String Catalog Tools, Siri AI, and Mac Permissions

Three changes are in beta as of November 25, 2026. None has shipped. Treat each as something to prepare for, not something to depend on.

Xcode 27.3 beta 2 (27C5035i, November 16) requires the same macOS Tahoe 26.6 or later. Its release notes add:27

  • GitHub Copilot in the coding assistant (185837709), next to the providers already there.
  • String Catalog tools for agents. “New tools allow coding agents to manipulate String Catalogs in the same ways that the String Catalog Editor does. For example, agents can add and remove strings, change state, and reference strings by Swift symbol.” (184511781) A new skill helps agents write localizable code and detect common localization problems (184951217).
  • Agent helpers for traces and hangs. Xcode adds two Apple specialists for coding agents, one for xctrace and one for hangs (187385971). They sit on a new xctrace triage subcommand that reports the hangs in a trace (182217728) and on xctrace exports of call trees, summaries, lists, and cost-annotated source code as plain text or Markdown (184951123), formats an agent can read directly. On my Mac, xcrun xctrace help on Xcode 27.2 (27B52) already lists triage and show, and the plugin directory Xcode 27.2 builds already holds an xctrace skill with a hang-triage reference, so check your installed Xcode before treating these as beta-only.39
  • UI tests in Swift Testing. “Xcode now supports writing UI tests with Swift Testing and XCUIAutomation.” (95593221)
  • Two operational notes. Xcode is now also distributed as an Apple Encrypted Archive (.aea), extracted with archiveutil extractXcodeAEA, and 27.3 is the final release supporting .xip (111337953). That matters if a script installs Xcode on a build machine. Xcode also now checks that simulator runtimes are unmodified: if you relaxed permissions on /Library, /Library/Developer, or /Library/Developer/CoreSimulator, simulators might not be discovered until you restore the shipping defaults, root:wheel 755 (187122954).

Siri AI opened to all developers (November 3). Apple’s announcement: “Starting today with the iOS 27.3, iPadOS 27.3, macOS 27.3, and visionOS 27.3 betas, a new Developer Preview enables any developer to integrate their app with Siri AI.” The integration point is App Intents. The preview “allows any app to bring its content and actions directly into Siri AI by using App Intents,” introduces skills “to let you teach Siri AI how to combine several actions into a single experience,” and lets Siri AI “surface any entity in the Spotlight semantic index, not just the ones that fit an existing schema.” Apple calls it “early access before first shipping to customers in a few months,” with App Store submission “opening up in the spring,” and says Siri AI is currently unavailable in the EU in iOS, iPadOS, and watchOS.30 My read for agent-built apps: the App Intents your agent writes become the surface Siri AI calls, so the App Intents item above deserves a place in your CLAUDE.md. Apple’s documentation is at Siri AI developer preview. I have not built against it.

Mac permissions for apps that control other apps (November 16). In macOS 27.3 beta 2, Apple split “Device Control and Data Access” into two settings, “System & App Protection Override” and “Accessibility,” and added guidance that steers users “to grant access to just the specific apps (for System & App Protection Override) or folders (for Full Disk Access) that are required for their workflows.” Users can configure an app to ask every time it needs access, and an indicator shows when an app is controlling another app. Apple also states: “All app permissions previously granted by users will remain in effect.”31 Its October 2 note on Full Disk Access gives the reason: “As AI agents become increasingly capable and autonomous, the risks associated with this level of access will grow substantially.”31 If your agent setup relies on a terminal or helper app that holds Full Disk Access or controls other apps, expect new grants on macOS 27.3 to be scoped to folders and apps. That expectation is my reading of the announcement. I have not tested it on the beta.


The Portfolio: 8 Apps, 293 Files

Before diving into configuration, here is what this guide is drawn from. These are not toy projects — they span five Apple frameworks, three platforms, and the full range of iOS complexity from a 14-file workout tracker to a 63-file multi-platform meditation timer.

App Stack Files Complexity
Banana List SwiftUI + SwiftData + iCloud Drive sync + MCP server for Claude Desktop 53 Full CRUD, iCloud sync, custom MCP server that exposes the app’s data to Claude Desktop
Ace Citizenship SwiftUI study app + FastAPI backend 26 Client-server, REST API integration, quiz engine
TappyColor SpriteKit color matching game 30 Game loop, physics, touch handling, particle effects
Return Zen meditation timer — iOS 26+, watchOS, tvOS 63 HealthKit, Live Activities, Watch extended runtime, TV focus navigation, iCloud session sync
amp97 Metal shaders + audio visualization 41 Custom Metal render pipeline, audio analysis, real-time GPU compute
Reps SwiftUI + SwiftData workout tracking 14 Minimal viable app, clean SwiftData patterns
Water SwiftUI + SwiftData + Metal + HealthKit hydration tracking 34 Metal fluid simulation, HealthKit water intake logging, widget
Starfield Destroyer SpriteKit + Metal space shooter 32 99 levels, 8 ships, Game Center leaderboards, Metal post-processing

Why the file counts matter: Agent effectiveness correlates with project legibility, not project size. Return (63 files) produces better agent output than amp97 (41 files) because Return has a detailed CLAUDE.md with file annotations, architecture diagrams, and explicit patterns. amp97’s Metal shaders are inherently harder for agents to reason about regardless of documentation quality.


Prerequisites

Before setting up any agent runtime for iOS development:

App Store Connect deadline: Starting 2026-04-28, app uploads to App Store Connect must be built with Xcode 26 or later using SDKs for iOS 26, iPadOS 26, tvOS 26, visionOS 26, or watchOS 26.40 (macOS submissions are not on this requirement.) If your team is still on Xcode 16.x, the agent-assisted toolchain in this guide doubles as a forcing function — Apple’s MCP server below does not exist before Xcode 26.3 anyway.

Required:

  • An Apple silicon Mac on macOS Tahoe 26.6 or later for Xcode 27, the current toolchain.18 The Xcode 26 line still works for iOS 26 targets: Xcode 26.6 requires macOS Tahoe 26.2 or later.17
  • Xcode 27.2 recommended (27B52, released 2026-10-29). It is the current stable release, carries the iOS 27.2 SDK, and is where Xcode’s agents take plug-ins, MCP servers, and simulator control.1828 Xcode 26.3 is the floor: it is the first release with xcrun mcpbridge. If you stay on the Xcode 26 line, use 26.6 (2026-06-25, build 17F113), the newest 26.x release in Apple’s releases feed, which added Google Gemini as a coding-assistant provider, Agent Client Protocol (ACP) support, and variant rendering (light/dark, orientation, type sizes) in the preview MCP tool, fixed two agent-turn crashes and the hang when an agent asks a question, and ships Swift 6.3 with the iOS 26.5-generation SDKs.17 The 26.5 workflow upgrades (message queuing in the coding assistant and clarifying-question support) and 26.4’s Swift Testing image attachments, recorded-issue severity, UI-test crash warnings with crashlogs, and String Catalog editor improvements all carry forward.4142 Earlier 26.x stables: 26.5 (2026-05-11, build 17F42) and 26.4.1 (2026-04-16, build 17E202).43
  • At least one iOS Simulator runtime installed
  • A Claude subscription (Pro, Max, Ultra, Team, or Enterprise) or a Claude Console account for Claude Code, or an OpenAI account for Codex38

Recommended:

  • SwiftFormat installed (brew install swiftformat) — used by format-on-save hooks
  • SwiftLint installed (brew install swiftlint) — optional but useful for style enforcement
  • Familiarity with the terminal — all three runtimes operate from or integrate with the command line

Verify your Xcode installation:

# Check Xcode version
xcodebuild -version
# Expected: Xcode 27.2 (26.3 is the minimum for xcrun mcpbridge)

# Check available simulators
xcrun simctl list devices available
# Expected: at least one iPhone simulator

# Verify xcrun mcpbridge is available
xcrun mcpbridge --help
# Expected: usage information (not "command not found")

If xcrun mcpbridge returns “command not found,” you need Xcode 26.3 or later. Install or update Xcode through the App Store or developer.apple.com. Note: xcode-select --install only installs Command Line Tools, which do not include mcpbridge — you need the full Xcode.app.


Three Agent Runtimes for iOS

Three distinct runtimes can write, build, and test iOS code. They are not interchangeable — each has different strengths, different MCP integration patterns, and different ideal use cases.

1. Claude Code CLI

What it is: Anthropic’s terminal-based agentic coding assistant. Reads your codebase, executes commands, modifies files, and connects to external tools via MCP.7

MCP integration: Full support for both MobileBuildMCP and Apple’s Xcode MCP. The agent discovers tools via MCP protocol and calls them with structured parameters. MobileBuildMCP advertises 82 tools; Apple’s server lists 54 on Xcode 27.2 and listed 20 on Xcode 26.3.2635

Setup:

# Install Claude Code (if not already installed)
claude --version  # verify installation

# Add MobileBuildMCP (82 tools: builds, tests, simulators, debugging)
claude mcp add MobileBuildMCP \
  -s user \
  -e MOBILEBUILDMCP_SENTRY_DISABLED=true \
  -- npx -y mobilebuildmcp@latest mcp

# Add Apple Xcode MCP (54 tools on Xcode 27.2: files, builds, tests, previews, docs, devices)
claude mcp add --transport stdio xcode \
  -s user -- xcrun mcpbridge

If your setup still says xcodebuildmcp, see Coming from XcodeBuildMCP below: the package, the binary, and every environment variable were renamed on September 23, 2026.

Optional: mobilebuildmcp init installs the project’s agent skill.

MobileBuildMCP ships two optional agent skills: an MCP skill that primes the agent on the server’s tools, and a CLI skill for agents that drive the mobilebuildmcp command line instead. init installs one of them:

mobilebuildmcp init
# Or without a global install:
npx -y mobilebuildmcp@latest init

At v2.7.1 the command installs the CLI skill by default (--skill mcp selects the other one) into .claude/skills for Claude Code or .agents/skills for other agents (--client claude or --client agents; the default auto-detects). --print writes the skill to stdout and --uninstall removes it. It does not register the MCP server, so it complements the claude mcp add commands above and does not replace them. With Claude Code and the MCP server you can skip it: the project’s docs say Claude Code already receives equivalent guidance through the server’s own instructions.44

Alternative for the Apple server: the xcode plugin (official marketplace, November 2026):

Since early November 2026, Anthropic’s official Claude Code marketplace lists an xcode plugin whose author field reads “Apple Inc.”48 It bundles the same Apple server as the second claude mcp add above and adds Apple’s own agent skills:

claude plugin install xcode@claude-plugins-official

The plugin’s source is a command, xcrun agent plugin path --plugin-format claude, which Xcode 27 answers by building a plugin directory and printing its path. I ran it on three Xcode 27 builds (the 27.1 release candidate, the 27.2 beta, and 27.2) on one Mac with the sudo xcrun mcp-server enable preview turned on (see Apple Xcode MCP below), and have not run it with that preview off. Claude Code displays the command and does not run it until a person accepts it; from a non-interactive shell on Claude Code 2.1.322 the install printed a message showing the command and stopped.49 For the install, my measurements stop at that message. On November 11 I loaded the directory for single sessions with --plugin-dir, which installs nothing, and Claude Code listed the skills under the xcode-integration: prefix. Apple’s Xcode Plugin for Claude Code: What It Installs has those measurements and how to read the directory before you accept the command.

On Xcode 27.2 the directory holds 16 Apple-written skills (SwiftUI, App Intents, accessibility audits, String Catalog translation, Swift Testing migration, and more) and an .mcp.json that declares a server named xcode running xcrun mcpbridge, the same name and command as the manual setup. If you already added that server by hand, check claude mcp list after installing. When I loaded the plugin with --plugin-dir beside my hand-added xcode server, Claude Code suppressed the plugin’s server as a duplicate and kept mine. I have not checked that after a marketplace install.

Codex and Gemini have their own formats (--plugin-format codex, --plugin-format gemini); I built both directories and loaded neither into its agent. For any other tool, the skills/ folder inside any of those directories is the full set as plain folders. xcrun agent skills export, the command Apple announced for writing the skills to disk, wrote 10 of 15 on the 27.1 release candidate and the 27.2 beta, the two builds where it finished; on 27.2 it hung, so its count there is missing. The five skills the export left out all name Xcode MCP tools, so they expect an agent with Xcode’s MCP server connected; two skills it does write name such tools too, so that cannot be the whole rule for what it omits. The skill inventory, the install message, and the measurements behind these numbers are in Xcode 27 Ships Agent Skills You Can Export Anywhere.

Best for: Deep implementation sessions — building new features, refactoring across multiple files, debugging complex issues, running build-test-fix loops autonomously. Claude Code’s 1M context window (with Opus 5.5, the default Opus model since v2.1.280) means the agent can hold a small-to-medium iOS project in working memory: by the estimates in Context Window Management, 50 Swift files come to roughly 50,000-100,000 tokens.32

Typical session:

You: Add a new SettingsView with toggles for notifications and haptic feedback.
     Use the existing Settings.swift pattern from TimerManager.
     Build for simulator after implementation and fix any errors.

Claude: [reads Settings.swift, TimerManager.swift, existing views]
        [creates SettingsView.swift]
        [calls build_sim via MCP]
        [reads structured error: missing import HealthKit]
        [fixes import]
        [calls build_sim again — success, 0 errors, 1 warning]
        [calls test_sim — all tests pass]

The key difference from pre-MCP workflow: the agent never asks you to build manually or paste error output. The build-error-fix loop is autonomous.

2. Codex CLI

What it is: OpenAI’s terminal-based coding agent. Similar in concept to Claude Code, but it runs OpenAI’s models and has a different permission model. The current stable CLI is 0.172.0 (November 24, 2026). Since 0.169.1 (November 17) its bundled catalog includes GPT-6.2 Sol and GPT-6.2 Astra, with Sol as the default selection. OpenAI’s models page recommends GPT-6.2 Astra for demanding work such as tracing a bug across services, GPT-6.2 Sol for everyday coding, GPT-6.1 Terra as a fast, efficient choice, and GPT-6 Luna for focused, repeatable tasks. GPT-5.6 Sol, Terra, and Luna are not in that recommended set, and GPT-5.3 Codex Spark retired on September 14, 2026. Available models vary by plan and client, so check /model in your own session.34

MCP integration: Codex supports MCP via the codex mcp add command. Apple’s Xcode MCP works directly:

# Add Apple Xcode MCP to Codex
codex mcp add xcode -- xcrun mcpbridge

MobileBuildMCP also works with Codex through the same npx command:

# Add MobileBuildMCP to Codex
codex mcp add MobileBuildMCP -- npx -y mobilebuildmcp@latest mcp

Best for: Headless batch operations, CI/CD integration, and tasks where you want a second opinion from a different model family. Codex’s sandbox mode runs code in isolated environments, which is useful for destructive operations like test suite runs that modify state.

Key differences from Claude Code:

  • Uses OpenAI models instead of Claude models
  • Different context window sizes and token economics
  • Sandbox-first permission model (more restrictive by default)
  • Smaller MCP ecosystem (fewer community servers tested)
  • Hooks system available (experimental engine in v0.114.0, stable since v0.124.0) with a shorter event list than Claude Code’s (14 events in OpenAI’s hooks reference) and no per-handler if condition in that reference. The config shape matches Claude Code’s: an event, a matcher group, then handlers34
  • Project instructions live in AGENTS.md, not CLAUDE.md34

When to use Codex over Claude Code for iOS:

Use Codex when you want model diversity — having a second agent review code written by the first catches different classes of errors. The collab workflow (Claude builds, Codex reviews) is effective for iOS because SwiftUI patterns that look correct to one model family may have subtle issues that another catches. Metal shaders and concurrency patterns benefit especially from dual-model review.

3. Xcode Native Agents

What it is: Apple integrated AI coding agents directly into Xcode’s Intelligence panel. As of Xcode 26.3, you can configure Claude Agent and Codex as intelligence providers in Xcode Settings > Intelligence.10 Xcode 26.6 widens the roster: Google Gemini is now available in the coding assistant (171990272), and Xcode adds Agent Client Protocol (ACP) support (178294840) — so what launched as a two-provider integration became three providers plus an open protocol that lets any ACP-compatible agent plug into the Intelligence panel.17 Xcode 27 added Google Antigravity (183074664), and the Xcode 27.3 beta adds GitHub Copilot (185837709).1827

Setup:

  1. Open Xcode 26.3+
  2. Navigate to Settings > Intelligence
  3. Turn on an agent. Apple’s Setting up coding intelligence page, read November 25, 2026, gives the steps: under Agents, click Get next to the agent, then Install; if you have an account with the provider, click the More button in the Account row of the agent’s settings and sign in. The page describes account sign-in and does not mention an API key, and this guide has not checked the Settings pane on Xcode 27.2 for a key field.
  4. For Claude: “Claude Agent”
  5. For Codex: “Codex”
  6. For Gemini: “Google Gemini” (Xcode 26.6+)
  7. For Google Antigravity: available in Xcode 27
  8. For GitHub Copilot: available in the Xcode 27.3 beta
  9. For anything else: connect an ACP-compatible agent (Xcode 26.6+)
  10. The agent appears in the Intelligence sidebar and can be invoked inline

Best for: Quick inline edits, code completion with agent-level reasoning, and developers who prefer not to leave Xcode. The native integration means the agent has direct access to Xcode’s project context — open files, build targets, scheme configuration — without MCP bridging.

Limitations compared to CLI agents — on Xcode 26.x:

  • No hook system — you cannot enforce format-on-save or block .pbxproj writes
  • No CLAUDE.md loading — the agent does not read your project-level configuration files
  • Limited autonomy — the agent operates on the current file or selection, not across the full project
  • No subagent delegation — complex multi-step tasks cannot be parallelized
  • No MCP server configuration — the agent uses Xcode’s built-in tools only

Xcode 27 invalidates most of that list. Since beta 1 (June 8), Xcode’s agents are an extension platform rather than an inline assistant:22

  • Plug-ins: “Agents in Xcode can now be extended with plugins that contain skills, MCP servers, and ACP agent configurations. Skills are invokable as slash commands with completion support.” (178289210) — so the “built-in tools only” and “no MCP configuration” limits are gone.
  • Simulator control: agents “can now boot simulators, install and launch apps, synthesize touch events, and capture screenshots to verify UI behavior” (175179787). They can also drive watchOS hardware inputs (181147968) and navigate tvOS apps with the Siri Remote (183317784).18
  • Debugger access: the Xcode MCP server gained tools to manipulate run state, read the debugger console, switch schemes and run destinations, and inspect or modify “build settings, compiler flags, entitlements, and Info.plist keys” (176935844).
  • A filesystem security layer “that monitors and controls filesystem access by coding agents and any processes they spawn” (178289431). The release notes say it “can be enabled in Coding Intelligence settings,” so check that it is on. Also first-class planning (172857081) and project insights covering crashes, hangs, energy, and launch issues (177568662).

One warning that follows directly from 176935844: Xcode’s agents can now edit build settings, entitlements, and Info.plist keys. The .pbxproj protection this guide builds with a PreToolUse hook does not apply inside Xcode, because the hook lives in your CLI agent’s configuration, not Apple’s. If you rely on that hook as your safety net, know that it has no jurisdiction over the Intelligence panel.

When to use Xcode native agents:

For quick, scoped edits where switching to the terminal is overhead. “Add a computed property to this model.” “Write a unit test for this function.” “Refactor this view to use @Observable.” Tasks that touch one or two files and do not require a build-test cycle.

For anything that requires building, testing, multi-file refactoring, or autonomous error correction, use a CLI agent with MCP.

That split is my practice from the Xcode 26 line. Xcode 27’s agents plan across a project, take MCP servers through plug-ins, and boot simulators to verify UI, and nothing in this guide measures them against a CLI agent on the same task. Read the split as how I work, not as a ranking of the two on Xcode 27.22

Runtime Comparison Matrix

Capability Claude Code CLI Codex CLI Xcode Native (26.x → 27)
MCP support Full (82 + 54 tools on Xcode 27.2) Full (82 + 54 tools on Xcode 27.2) 26.x: built-in tools only; 27: MCP servers via plug-ins22
Hook system Yes (mature) Yes (stable since v0.124.0, shorter event list) No
CLAUDE.md / project config Yes AGENTS.md No
Autonomous build-test-fix Yes (via MCP) Yes (via MCP) 26.x: partial (inline only); 27: boots simulators and verifies UI22
Subagent delegation Yes (20 running at once by default) Yes (subagent workflows on by default) No
Context window 1M tokens (Opus 5.5) Varies by model Varies by provider
Multi-file operations Full codebase access Full codebase access 26.x: current file / selection; 27: project-wide with planning22
.pbxproj protection Via hooks Manual N/A (uses Xcode natively)
Format-on-save Via PostToolUse hooks External tooling Xcode settings
Offline capability No No No
Cost model Claude subscription or API usage ChatGPT plan or OpenAI API usage The provider’s account

Sources for the Codex column and the Claude Code subagent and context rows: 3234.

The recommendation: Use Claude Code CLI as your primary runtime. Use Xcode native agents for quick inline edits (my habit from Xcode 26.x; see the note under Xcode Native Agents). Use Codex CLI for review passes and batch operations. The three complement rather than compete.


MCP Setup: The Complete Configuration

MCP (Model Context Protocol) is what transforms an agent from “writes Swift and hopes you build it” to “writes Swift, builds it, reads structured errors, and fixes them.”2 This section goes deeper than the blog post11 — covering both servers, all installation methods, verification, and the agent configuration that ensures tools are actually used.

MobileBuildMCP: 82 Tools for Headless iOS Development

MobileBuildMCP wraps xcodebuild, xcrun simctl, and LLDB into 82 structured MCP tools.326 The project was named XcodeBuildMCP until v2.7.1 (September 23, 2026), and older writeups, including earlier versions of this guide, use that name. Sentry maintains it in the getsentry GitHub org; both the old getsentry/XcodeBuildMCP address and the original cameroncooke/XcodeBuildMCP address redirect to the new repository.2126 It works without Xcode running: the whole build-test-debug cycle operates headlessly through Apple’s command-line tools.

Two inventory notes are worth knowing. A default stdio session exposes only the simulator workflow’s 20 tools plus session-default management, and keeps the rest out of your agent’s context. Set MOBILEBUILDMCP_ENABLED_WORKFLOWS (comma-separated category names from the table below) to load more. The same engine also ships as a CLI: mobilebuildmcp tools at v2.7.1 reports 100 commands, 72 canonical, across the same 12 categories, if you want identical operations without MCP.926

Installation options:

# Option 1: Via npx (recommended; always uses the latest version)
claude mcp add MobileBuildMCP \
  -s user \
  -e MOBILEBUILDMCP_SENTRY_DISABLED=true \
  -- npx -y mobilebuildmcp@latest mcp

# Option 2: Via Homebrew (no Node.js; upgrade with `mobilebuildmcp upgrade`)
brew tap getsentry/xcodebuildmcp
brew install mobilebuildmcp
claude mcp add MobileBuildMCP \
  -s user \
  -e MOBILEBUILDMCP_SENTRY_DISABLED=true \
  -- mobilebuildmcp mcp

# Option 3: Local scope, this project only (omit -s user)
claude mcp add MobileBuildMCP \
  -e MOBILEBUILDMCP_SENTRY_DISABLED=true \
  -- npx -y mobilebuildmcp@latest mcp

The Homebrew tap kept its old name (getsentry/xcodebuildmcp); the formula inside it is mobilebuildmcp.26

The -s user flag makes the server available across all your projects. Omit it and Claude Code uses its default, local scope: the server loads only in the project where you added it and stays private to you (useful if you want MCP in iOS projects and not web projects). -s project is a third scope, which writes the server to a .mcp.json file at the project root that you can commit for a team.38

The -e MOBILEBUILDMCP_SENTRY_DISABLED=true environment variable turns off the project’s error telemetry. MobileBuildMCP reports its own runtime failures to Sentry by default. The project’s privacy page says the scope is internal failures only, with home paths redacted and no tool inputs, outputs, or build errors sent. Opt out unless you want to contribute diagnostics to the project.1

Coming from XcodeBuildMCP

The v2.7.1 release renamed everything that carried the old name. The tool inventory is the same 82 tools as v2.7.0.26 If you installed under the old name, four things need your attention:

  • Package and binary. xcodebuildmcp on npm stops at 2.7.0 (July 23, 2026). It still installs and runs, and npm shows no deprecation notice on it, but new releases go to mobilebuildmcp only. Replace the registration with the commands below this list.
  • Environment variables. Every XCODEBUILDMCP_* variable is now MOBILEBUILDMCP_*. The v2.7.1 source reads only the new names, so an old XCODEBUILDMCP_SENTRY_DISABLED=true passed to the new package no longer opts you out of telemetry. Rename each variable when you switch.
  • Project config and state. The project config directory is .mobilebuildmcp/config.yaml and the state directory is ~/Library/Developer/MobileBuildMCP.
  • Tool names in permissions and agent files. Claude Code names MCP tools after the server you registered (mcp__MobileBuildMCP__build_sim), so permission rules, agent definitions, and CLAUDE.md lines that name mcp__XcodeBuildMCP__... need the new server name. The tool names themselves (build_sim, test_sim, and the rest) did not change.
# Replace an old registration
claude mcp remove XcodeBuildMCP
claude mcp add MobileBuildMCP -s user \
  -e MOBILEBUILDMCP_SENTRY_DISABLED=true \
  -- npx -y mobilebuildmcp@latest mcp

One input shape changed in the same release: env and testRunnerEnv on build, launch, test, and session-default tools are now arrays of { "key": "...", "value": "..." } entries, and xcode_ide_call_tool.arguments is a JSON object string. Agents read the tool schema and adapt, but a script that calls these tools with a plain dictionary needs updating.26

Tool inventory (82 tools; representative tools from the 12 workflow categories you can enable):

Category Tools What They Do
project-discovery discover_projs, list_schemes, show_build_settings, get_app_bundle_id Find .xcodeproj/.xcworkspace files, list schemes, inspect build settings
simulator build_sim, build_run_sim, test_sim, install_app_sim, launch_app_sim Build and test with structured error/warning output by file and line; install and launch on simulator
simulator-management list_sims, boot_sim, open_sim, erase_sims, set_sim_appearance, set_sim_location, session_set_defaults Boot, erase, and configure simulators (appearance, location, status bar)
device build_device, test_device, list_devices, install_app_device, launch_app_device Real device build, test, deployment, and management
macos build_macos, build_run_macos, test_macos The same build-test loop for Mac targets
swift-package swift_package_build, swift_package_test, swift_package_run SwiftPM build/test/run without an .xcodeproj
coverage get_coverage_report, get_file_coverage Per-target and function-level coverage from .xcresult bundles
debugging debug_attach_sim, debug_breakpoint_add, debug_stack, debug_variables, debug_lldb_command, debug_continue, debug_detach Full LLDB integration with breakpoints and variable inspection
ui-automation snapshot_ui, wait_for_ui, batch, tap, drag, swipe, type_text, gesture, screenshot, record_sim_video Runtime UI automation with stable element references (v2.6.0+), plus visual capture
project-scaffolding scaffold_ios_project, scaffold_macos_project Create new iOS/macOS projects from templates
utilities clean Clean build products
xcode-ide xcode_ide_list_tools, xcode_ide_call_tool Discover and call Xcode-IDE-only MCP tools through MobileBuildMCP (see below)

The tools that matter most for daily work:

  1. build_sim — You will call this hundreds of times. It returns JSON with errors categorized by file, line, and severity. The agent reads the error, navigates to the file, and fixes it without you touching anything.

  2. test_sim — Returns per-test-method results. The agent knows exactly which test failed and why, not just “tests failed.”

  3. list_sims + boot_sim — Simulator management without memorizing xcrun simctl flags. The agent discovers available runtimes and picks an appropriate device.

  4. discover_projs + list_schemes — Project introspection. The agent does not need to guess your scheme name or workspace structure.

  5. debug_attach_sim + debug_stack + debug_variables — Remote LLDB debugging. The agent can set breakpoints, inspect variables, and step through code without you opening the debugger.

What v2.6.0 changed (2026-06-01) — runtime UI automation:

The v2.6.0 release rebuilt UI automation around reusable context instead of one-shot screenshots.19 snapshot_ui now returns stable element references and a screen hash, and accepts sinceScreenHash so the agent can skip a full snapshot when the screen has not changed. Three new tools close the loop: wait_for_ui polls until a predicate is satisfied (existence, enabled state, focus, visible text, or settled layout) instead of the agent guessing with sleeps; batch performs a sequence of element-reference actions in a single call; drag does element-reference drag gestures for sheets and list scrolling. type_text gained replaceExisting to replace a field’s value rather than append to it, candidate controls are ranked from accessibility data, and structured results now include nextSteps hints (result schemas were versioned to v2 in this release; v2.7.0 has since moved build/test results to schemaVersion: 3 — see below). Set MOBILEBUILDMCP_HEADLESS_LAUNCH=true (named XCODEBUILDMCP_HEADLESS_LAUNCH before v2.7.1) to launch apps in the background without stealing macOS focus — the difference between an agent session you can leave running and one that keeps yanking your Simulator window forward. On a deterministic Weather-app task, the project’s own benchmark claims roughly 70% less wall-clock time, 68% fewer tokens, and 76% fewer tool calls versus the pre-2.6 flow — the project’s numbers, not an independent measurement, but the mechanism (skip unchanged snapshots, batch same-screen actions) is exactly where UI-automation token burn comes from.19

What v2.7.0 changed (2026-07-23) — Xcode 27 simulators, schema v3, scheme-respecting builds:

The v2.7.0 release is smaller than 2.6.0 but carries one breaking change and one behavior change worth knowing before you upgrade.21 The headline: UI automation tools now work fully with Xcode 27 simulators through Device Hub, including simulator window launching and keyboard controls — closing the gap where runtime UI automation was only reliable against Xcode 26 simulators. Breaking: build and test tools now return schemaVersion: 3 structured results (they had been v2 since 2.6.0) — anything you wrote that validates or parses results pinned to version 2 needs updating. Behavior change: build, test, clean, and app-path tools now honor the scheme action’s configuration when configuration is omitted, instead of always defaulting to Debug — if a scheme’s Test action is set to Release, an unqualified test_sim now builds Release, so pass configuration explicitly where your workflow depends on a specific one. Smaller but useful: reusable .xctestproducts test-preparation packages let tests re-run without rebuilding while still producing a fresh .xcresult each run; session-default extraArgs lets you set common xcodebuild flags once per session instead of repeating them per call; a new purge CLI command (today mobilebuildmcp purge) reports and cleans the tool’s workspace storage (dry-run by default, explicit opt-in to delete); and a fix landed for MCP clients waiting 10-17 seconds for tools to become available — which could make short health checks report a failed connection.21

What v2.7.1 changed (2026-09-23): the rename to MobileBuildMCP and the array-shaped env inputs, both covered in Coming from XcodeBuildMCP above. It is the current release as of November 25, 2026.26

Apple Xcode MCP: Bridging into Xcode

Apple’s MCP server first shipped with Xcode 26.3 via xcrun mcpbridge.4 It communicates with a running Xcode process through XPC (Apple’s inter-process communication framework), exposing internal state that no CLI tool can access.5 On Xcode 27.2 (27B52) the bridge lists 54 tools; the Xcode 26.3 inventory further down had 20.

Installation:

# Standard installation (global)
claude mcp add --transport stdio xcode \
  -s user -- xcrun mcpbridge

# For Codex CLI
codex mcp add xcode -- xcrun mcpbridge

Requires Xcode 26.3+ and a running Xcode process. If Xcode is not open, every MCP call through this server will fail or hang. MobileBuildMCP does not have this limitation.

Xcode 27 previews a way out of that constraint. Beta 5 added “a new MCP server experience that runs without requiring an open Xcode workspace,” enabled with sudo xcrun mcp-server enable and inspected with xcrun mcp-server status, and the shipped Xcode 27 release notes still carry it as an early preview. The same preview lets you grant code-signed agents durable permission to work inside a directory tree instead of re-approving each time. For unattended runs, sudo xcrun mcp-server enable --unsafe-always-allow-all-agents approves everything up front. Apple calls that “not a recommended configuration for at-desk use,” and neither do I: it removes the approval step that keeps an agent out of directories you did not mean to expose. Keep MobileBuildMCP as the headless path until Apple stops calling this a preview.1822

After an Xcode update, check for a hidden Xcode before you trust xcrun mcpbridge. On Xcode 27.2, with that preview turned on, xcrun agent skills export launched Xcode hidden when none was running. The hidden Xcode I sampled was sitting at its first-launch screen, a modal window nobody can see, and the export waited on it with no timeout and no error. An earlier hidden Xcode showed the same offscreen window; a Claude Code session’s xcrun mcpbridge selected it over the preview’s background service, and that session’s MCP tool call waited the same way. pgrep -lx Xcode lists every running Xcode, including one you did not open, and kill <pid> ended each hidden one here. The rest of the remedy the evidence points to, which I have not yet confirmed on 27.2, is to open Xcode normally, finish the first-launch screen, and restart the Xcode MCP server in any session that called it during the hang. The log lines and what the process sample showed are in the agent skills export post.

Tool inventory on Xcode 27.2 (54 tools). This is the list a Claude Code 2.1.332 session of mine showed for the xcode server on November 25, 2026, the same count I measured on November 11. The grouping and the short descriptions are mine; quoted text comes from the tool definitions.35

Category Tools What They Do
Files (9) XcodeRead, XcodeWrite, XcodeUpdate, XcodeGlob, XcodeGrep, XcodeLS, XcodeMV, XcodeRM, XcodeMakeDir Read, write, search, move, and remove files by their path in the Xcode project. XcodeWrite “automatically adds new files to the project structure”
Workspace, schemes, destinations (10) XcodeListWorkspaces, XcodeOpenWorkspace, XcodeCloseWorkspace, XcodeListTargets, XcodeListSchemes, XcodeSwitchScheme, XcodeListRunDestinations, XcodeSwitchRunDestination, XcodeListTestPlans, XcodeSwitchTestPlan Open a project, then list and switch the active scheme, run destination, and test plan
Project creation and settings (9) XcodeListTemplates, XcodeNewProject, XcodeNewTarget, GetTargetBuildSettings, UpdateTargetBuildSetting, GetFileCompilerFlags, UpdateFileCompilerFlags, AddEntitlement, AddInfoPlist Create a project or target from an Xcode template, and read or change build settings, compiler flags, entitlements, and Info.plist keys through Xcode
Build, run, test (8) BuildProject, GetBuildLog, XcodeRefreshCodeIssuesInFile, RunProject, StopProject, GetTestList, RunAllTests, RunSomeTests Build with Xcode’s build system, read compiler diagnostics for a file, run the active scheme, and run all or selected tests
Debugging (2) InvokeDebuggerCommand, GetConsoleOutput Send LLDB commands to Xcode’s active debug session; read stdout, stderr, and OSLog from a launch
Device and simulator interaction (5) DeviceInteractionStartSession, DeviceInteractionStartWorkspaceSession, DeviceInteractionInstallAndRun, DeviceInteractionSynthesize, DeviceInteractionEndSession Boot a device or simulator, install and run the app, synthesize taps, swipes, typing, and button presses, and get back a screenshot and UI hierarchy
Previews, snippets, documentation (3) RenderPreview, RunCodeSnippet, DocumentationSearch Render a SwiftUI preview to a snapshot, run a Swift snippet in a file’s context, search Apple’s developer documentation
Localization (4) LocalizationPlanner, StringCatalogRead, StringCatalogContext, StringCatalogEdit Prepare a project for a new language and read, get context for, and insert translations in String Catalogs
Field diagnostics (4) GetTopCrashIssues, GetCrashIssueLogs, GetTopFieldPerformanceIssues, GetFieldPerformanceIssueLogs Top crash signatures and their logs; launch, hang, disk-write, and energy reports from the field

Two names changed from the Xcode 26.3 inventory, and both matter if your CLAUDE.md names them. The Swift snippet tool is RunCodeSnippet on Xcode 27.2 (ExecuteSnippet on 26.3), and the 27.2 list has no XcodeListNavigatorIssues; the per-file XcodeRefreshCodeIssuesInFile is the diagnostics tool that remains. The examples in this guide use the Xcode 27.2 names.

Tool inventory on Xcode 26.3 (20 tools across 5 categories), for readers still on the Xcode 26 line:

Category Tools What They Do
File operations XcodeRead, XcodeWrite, XcodeUpdate, XcodeGlob, XcodeGrep Read/write files within the Xcode project context
Build & test BuildProject, GetBuildLog, RunAllTests, RunSomeTests Build and test with Xcode’s internal build system
Diagnostics XcodeListNavigatorIssues, XcodeRefreshCodeIssuesInFile Real-time code diagnostics (not just build errors)
Code & documentation ExecuteSnippet, DocumentationSearch Swift REPL execution and Apple documentation search
Previews RenderPreview Headless SwiftUI preview rendering

Tools that are unique to Apple MCP (not available in MobileBuildMCP):

  1. DocumentationSearch searches Apple’s developer documentation by semantic match. It is faster and more reliable than web search for Apple API questions. Ask “is HKQuantityType(.dietaryWater) valid?” and get an answer from the source.

  2. RunCodeSnippet (ExecuteSnippet on Xcode 26.3) builds and runs a Swift snippet in the context of a file in your project and returns what it prints. The agent can verify API behavior, test type conversions, and validate expressions without running the full app.

  3. RenderPreview builds a SwiftUI preview and returns a snapshot. The agent can check that a view renders without errors and look at the snapshot; I still review layout myself (see What Agents Do Poorly). Xcode 26.6 added variant rendering: light/dark appearance, portrait/landscape orientation, and type-size overrides (178831772).17 Xcode 27 added Preview groups and localization overrides, and Xcode 27.2 lets the caller choose the render destination.1829

  4. XcodeRefreshCodeIssuesInFile returns the current compiler diagnostics (errors, warnings, notes) for one file without a full build.

  5. The project tools, XcodeNewTarget, XcodeNewProject, AddEntitlement, AddInfoPlist, and UpdateTargetBuildSetting, change project configuration through Xcode itself. Their descriptions tell the agent not to edit project.pbxproj or the entitlements file directly. I have not used them on a shipping app; see the .pbxproj section for how I treat them.

Why Both Servers

They overlap on builds and tests but differ fundamentally:

┌─────────────────────────────────────────────────────────────────┐
│                     MCP TOOL COVERAGE                           │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  MobileBuildMCP (82 tools)       Apple Xcode MCP (54 tools)    │
│  ┌─────────────────────┐         ┌─────────────────────┐       │
│  │ Standalone           │         │ Requires Xcode      │       │
│  │ (no Xcode process)  │         │ (XPC bridge)        │       │
│  │                     │         │                     │       │
│  │ ✓ Simulators        │  BOTH   │ ✓ Documentation     │       │
│  │ ✓ Real devices      │ ┌─────┐ │ ✓ Swift snippets    │       │
│  │ ✓ LLDB debugging    │ │Build│ │ ✓ SwiftUI previews  │       │
│  │ ✓ UI automation     │ │Test │ │ ✓ Live diagnostics  │       │
│  │ ✓ Project scaffold  │ └─────┘ │ ✓ Project settings  │       │
│  │ ✓ Screenshot        │         │ ✓ String Catalogs   │       │
│  └─────────────────────┘         └─────────────────────┘       │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Use MobileBuildMCP for: The build-test-debug cycle. It works without Xcode open, consumes less system memory, and provides richer simulator and device management. This is your primary build tool.

Use Apple Xcode MCP for: Documentation lookups, Swift snippet verification, SwiftUI preview rendering, per-file diagnostics, and, on Xcode 27, String Catalog work and project settings. Keep Xcode open during sessions that need these capabilities.

In practice: I use MobileBuildMCP for ~90% of MCP calls and Apple Xcode MCP for documentation and snippet verification. The agent defaults to MobileBuildMCP for builds and tests because it is faster (no Xcode process overhead) and more reliable (no XPC dependency).

The two-server framing is softening. Since 2.6.x the server has an xcode-ide proxy category: xcode_ide_list_tools discovers the Xcode-IDE-only MCP capabilities and xcode_ide_call_tool invokes them (they surface with xcode_tools_* names, e.g. xcode_tools_documentationsearch), so a single MobileBuildMCP registration can reach Apple’s IDE-side tools too.19 The constraint that matters does not move: those proxied calls still require a running Xcode process, exactly like a direct xcrun mcpbridge registration. Keep both servers registered if you want Apple’s tools first-class in the agent’s tool list; the proxy is most useful when you want one server entry and only occasional IDE reads.

Verification

After installing both servers, verify they are connected:

# List all configured MCP servers
claude mcp list

# Expected output includes:
# MobileBuildMCP: npx -y mobilebuildmcp@latest mcp - Connected
# xcode: xcrun mcpbridge - Connected

If a server shows “Disconnected” or does not appear:

  1. MobileBuildMCP not connecting: Ensure Node.js is installed (node --version). The npx command requires Node.js 18+.
  2. Apple Xcode MCP not connecting: Ensure Xcode 26.3+ is installed and the xcrun mcpbridge command works in your terminal. Open Xcode at least once to accept the license agreement.
  3. Both not appearing: Restart Claude Code (claude in a new terminal). MCP servers registered mid-session may not appear until restart.

Teaching the Agent to Use MCP

Installing MCP servers is necessary but insufficient. Without explicit guidance, the agent may fall back to running xcodebuild via Bash (unstructured output, wasted context tokens) or using web search for Apple documentation (slower, less reliable).

Add this to your CLAUDE.md or agent definition:

## Build & Test — Always Use MCP

Prefer MCP tools over raw shell commands for ALL build operations:

- **Build**: `build_sim` / `build_device` (NOT `xcodebuild` via Bash)
- **Test**: `test_sim` / `test_device` (NOT `xcodebuild test` via Bash)
- **Simulators**: `list_sims`, `boot_sim`, `open_sim` (NOT `xcrun simctl` via Bash)
- **Debug**: `debug_attach_sim`, `debug_stack`, `debug_variables`
- **Apple docs**: `DocumentationSearch` (NOT WebSearch for Apple APIs)
- **Swift verification**: `RunCodeSnippet` (NOT `swift` via Bash)
- **Previews**: `RenderPreview` for headless SwiftUI verification

MCP returns structured JSON. Bash returns unstructured text.
Structured data means fewer tokens consumed and better error diagnosis.

RunCodeSnippet is the Xcode 27 name; write ExecuteSnippet if the project is still on Xcode 26. This guidance ensures the agent reaches for MCP tools first. Without it, you will observe the agent constructing long xcodebuild commands via Bash, consuming thousands of context tokens parsing the output, and sometimes misidentifying the actual error.6

One behavior change from v2.7.0 belongs in this section’s mental model: when configuration is omitted, build, test, clean, and app-path tools now honor the scheme action’s configuration instead of always using Debug.21 Most schemes run and test in Debug, so most projects will notice nothing — but if a scheme’s action is set to Release (common for profiling schemes or archive-adjacent setups), an unqualified build_sim or test_sim now builds Release. If your CLAUDE.md or hooks assume Debug artifacts, either say so explicitly in the tool call or set it once per session with session_set_defaults.

Long-Running Builds: Claude Code Now Backgrounds Them

Two Claude Code releases changed what a long build looks like from inside a session. Since v2.1.212 (2026-07-16), any MCP tool call that runs longer than 2 minutes automatically moves to the background so the session stays usable; the threshold is configurable — or the behavior disabled — via CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS.20 Clean builds and full test runs through build_sim / test_sim routinely cross the 2-minute line on real projects, so expect the agent to keep working — reading files, planning the next edit — while the build finishes in the background instead of blocking the turn. The companion fix matters just as much: before v2.1.206 (2026-07-09), a per-server request_timeout_ms configured via --mcp-config or .mcp.json was ignored in fresh sessions, so long MCP calls timed out at the 60-second default — the classic symptom was a first-clean-build timeout that “fixed itself” on retry.20 If you worked around either behavior with wrapper scripts or pre-warmed builds, you can delete the workaround.


CLAUDE.md Patterns for iOS Projects

Your CLAUDE.md is the most important file in the project for agent-assisted development. It is the agent’s onboarding document — the difference between a new hire who read the architecture docs and one who is guessing.

Every iOS project I maintain has a CLAUDE.md. Here are the patterns that work, drawn from all 8 apps.

The Essential Sections

Every iOS CLAUDE.md needs these six sections. Everything else is optional.

1. Project Identity

# Return - Zen Focus Timer

**Bundle ID:** `com.941apps.Return`
**Target:** iOS 26+ / macOS Tahoe / watchOS 26+ / tvOS 26+
**Architecture:** SwiftUI with @Observable pattern, companion Watch and TV apps
**Swift version:** 6.2
**Minimum deployment:** iOS 26.0

Why this matters: The agent needs to know the deployment target before writing any code. An agent targeting iOS 17 will use NavigationView and @ObservedObject. An agent targeting iOS 26 will use NavigationStack and @Observable. The bundle ID matters for entitlements and HealthKit configuration. The Swift version determines concurrency model (async/await vs. completion handlers, strict concurrency vs. lenient).

2. File Structure with Purpose Annotations

## File Structure

```
Return/
├── ReturnApp.swift              # App entry, dark mode enforcement
├── ContentView.swift            # Main timer view with theme backgrounds
├── TimerManager.swift           # Timer state, logic, and repeat handling
├── AudioManager.swift           # Sound playback with AVAudioPlayer
├── Settings.swift               # Centralized settings with validation
├── SettingsSheet.swift          # Settings UI
├── HealthKitManager.swift       # Mindful session logging + cross-device sync
├── LiveActivityManager.swift    # Lock Screen/Dynamic Island
├── Theme.swift                  # Theme definitions
├── ThemeManager.swift           # Theme state management
├── VideoBackgroundView.swift    # AVPlayer video backgrounds
├── GlassTextShape.swift         # Core Text glyph paths for glass effect
├── GlassTimerText.swift         # Timer text with glass material
└── Constants.swift              # App constants
```

The inline comments after each filename are not decoration. They are the single highest-leverage documentation you can write. When the agent is deciding where to add a new feature, these annotations guide it to the correct file on the first attempt instead of reading every file to understand the project layout.

Anti-pattern: Listing files without annotations. TimerManager.swift tells the agent nothing about whether it handles state, UI, or both. TimerManager.swift # Timer state, logic, and repeat handling tells it exactly what belongs there and what does not.

3. Build and Test Commands

## Build & Test

Build for iOS simulator:
```bash
xcodebuild -scheme Return -destination 'platform=iOS Simulator,name=<simulator name>' build
```

Run tests:
```bash
xcodebuild -scheme Return -destination 'platform=iOS Simulator,name=<simulator name>' test
```

Run tvOS tests:
```bash
xcodebuild -scheme ReturnTV -destination 'platform=tvOS Simulator,name=<Apple TV simulator name>' test
```

**Prefer MCP tools** (`build_sim`, `test_sim`) over these raw commands.
MCP returns structured JSON with categorized errors.

Include the raw commands even though the agent should prefer MCP. The raw commands serve as fallback documentation and make the scheme names and destinations explicit. Replace <simulator name> with a device your Xcode has: xcrun simctl list devices available prints them, and xcodebuild -showdestinations with your -scheme prints the destinations that scheme accepts. A destination can also name a simulator by id, and the xcodebuild man page documents a generic/ prefix (its example is generic/platform=iOS) for building against a platform with no particular device.39

4. Key Patterns and Rules

## Key Patterns

### Observable Architecture

- ALL view models use `@Observable` (NEVER `ObservableObject`)
- ALL navigation uses `NavigationStack` (NEVER `NavigationView`)
- State management via `@Observable` classes with `@MainActor` isolation

### Settings Pattern

- Centralized `Settings.shared` singleton
- All settings bounded to valid ranges with validation
- Sound names validated against whitelist
- Thread-safe access via @MainActor

### Audio System

- `AVAudioPlayer` with `.playback` category (plays in silent mode)
- Silent audio loop for background execution
- Bell playback with completion callbacks and token-based staleness

These patterns prevent the agent from introducing inconsistencies. Without explicit pattern documentation, the agent will sometimes use ObservableObject in one file and @Observable in another, or create a new settings mechanism instead of using the existing Settings.shared singleton.

5. Things the Agent Must Never Do

## Rules

- **NEVER modify .pbxproj files** — create Swift files, then I will add them to Xcode manually
- **NEVER modify .xcodeproj/ contents directly**
- **NEVER add new package dependencies** without asking first
- **NEVER change the deployment target**
- **NEVER modify entitlements files** unless explicitly asked
- **NEVER use NavigationView** — always NavigationStack
- **NEVER use ObservableObject** — always @Observable
- **NEVER use @StateObject** — always @State with @Observable

Explicit prohibitions are more effective than implicit expectations. The agent follows negative constraints more reliably than positive suggestions because they are binary (do it / do not do it) rather than heuristic (prefer this / sometimes use that).

6. Framework-Specific Context

This section varies by app. Include it for any framework that has non-obvious configuration:

For HealthKit apps:

## HealthKit Configuration

- Entitlement: `com.apple.developer.healthkit`
- Info.plist keys:
  - `NSHealthShareUsageDescription`: "Return reads your mindful minutes..."
  - `NSHealthUpdateUsageDescription`: "Return logs meditation sessions..."
- Category types: `HKCategoryType(.mindfulSession)`
- Authorization checked on every write (user can revoke at any time)
- HealthKit is unavailable on tvOS — guard with `#if canImport(HealthKit)`

For SwiftData apps:

## SwiftData Models

### Model Relationships

- `GroceryList` has many `GroceryItem` (cascade delete)
- `GroceryItem` belongs to one `GroceryList`
- `GroceryItem` has optional `Category`

### Model Container Setup

- Configured in App struct with `modelContainer(for:)`
- Schema versioning: currently V2
- Migration plan: `GroceryMigrationPlan` handles V1 → V2

### Queries

- `@Query(sort: \GroceryItem.name)` for sorted fetches
- `@Query(filter: #Predicate { !$0.isCompleted })` for active items
- Always use `@Query` in views, `modelContext.fetch()` in managers

For SpriteKit apps:

## SpriteKit Scene Hierarchy

```
GameScene (SKScene)
├── backgroundLayer (SKNode, zPosition: -100)
│   └── StarfieldNode (custom, parallax scrolling)
├── gameLayer (SKNode, zPosition: 0)
│   ├── playerShip (PlayerNode, zPosition: 10)
│   ├── enemyContainer (SKNode, zPosition: 5)
│   └── bulletPool (SKNode, zPosition: 8)
├── effectsLayer (SKNode, zPosition: 50)
│   └── ParticleManager (manages explosion/trail emitters)
└── hudLayer (SKNode, zPosition: 100)
    ├── scoreLabel (SKLabelNode)
    └── healthBar (HealthBarNode)
```

- Physics categories defined in `PhysicsCategory.swift` as bitmasks
- Contact detection via `didBegin(_ contact:)` on GameScene
- Bullet pooling: pre-allocate 50, recycle via `removeFromParent()` + re-add

For Metal apps:

## Metal Pipeline

- Render pipeline: `MetalView` → `Renderer` → `ShaderLibrary`
- Compute pipeline: `AudioAnalyzer` → compute shader → texture output
- Shared uniforms struct: `Uniforms` in `ShaderTypes.h` (bridged to Swift)
- Frame timing: `CADisplayLink` drives render loop
- Buffer triple-buffering: 3 in-flight frames with semaphore

### Shader Files

- `Shaders.metal` — Main render shaders (vertex + fragment)
- `Compute.metal` — Audio analysis compute kernel
- `PostProcess.metal` — Bloom and color grading

### DO NOT modify Metal shaders without testing on device.
Simulator Metal is not representative of device GPU behavior.

Real CLAUDE.md: Banana List (SwiftUI + SwiftData + iCloud + MCP Server)

Here is an annotated example showing how all six sections work together for a moderately complex app. This is the CLAUDE.md pattern I use for Banana List, a 53-file grocery list app with iCloud sync and a custom MCP server that exposes the app’s data to Claude Desktop:

# Banana List - Grocery List App

**Bundle ID:** `com.941apps.BananaList`
**Target:** iOS 26+
**Architecture:** SwiftUI + SwiftData + iCloud Drive sync
**Swift version:** 6.2
**Minimum deployment:** iOS 26.0

## Core Features

- Grocery lists with items, categories, and quantities
- iCloud Drive sync via SwiftData CloudKit integration
- Custom MCP server exposing list data to Claude Desktop
- Liquid Glass design system
- Haptic feedback on interactions
- Share sheets for list sharing

## File Structure

```
BananaList/
├── BananaListApp.swift           # App entry, model container setup
├── Models/
│   ├── GroceryList.swift         # @Model: list with name, items, color
│   ├── GroceryItem.swift         # @Model: item with name, quantity, category, isCompleted
│   ├── Category.swift            # @Model: user-defined categories
│   └── SampleData.swift          # Preview and test data
├── Views/
│   ├── ListsView.swift           # Main list of grocery lists
│   ├── ListDetailView.swift      # Items within a list
│   ├── ItemRow.swift             # Single item row with swipe actions
│   ├── AddItemSheet.swift        # New item form
│   ├── CategoryPicker.swift      # Category selection with create-new
│   └── SettingsView.swift        # App settings
├── Managers/
│   ├── CloudSyncManager.swift    # iCloud Drive sync status and conflict resolution
│   └── HapticManager.swift       # UIImpactFeedbackGenerator wrapper
├── MCP/
│   ├── MCPServer.swift           # MCP server for Claude Desktop integration
│   ├── ListTools.swift           # MCP tools: list CRUD operations
│   └── ItemTools.swift           # MCP tools: item CRUD operations
└── Extensions/
    ├── Color+Extensions.swift    # Custom color definitions
    └── View+Extensions.swift     # Reusable view modifiers
```

## SwiftData Models

### Relationships

- `GroceryList` has many `GroceryItem` (cascade delete)
- `GroceryItem` belongs to one `GroceryList` (required)
- `GroceryItem` has optional `Category`
- `Category` has many `GroceryItem` (nullify on delete)

### Container Setup
```swift
@main
struct BananaListApp: App {
    var body: some Scene {
        WindowGroup {
            ListsView()
        }
        .modelContainer(for: [GroceryList.self, GroceryItem.self, Category.self])
    }
}
```

### Query Patterns

- Lists: `@Query(sort: \GroceryList.name) var lists: [GroceryList]`
- Active items: `@Query(filter: #Predicate { !$0.isCompleted })`
- By category: filter in-memory after fetch (SwiftData predicate limitations)

## Build & Test

```bash
xcodebuild -scheme BananaList -destination 'platform=iOS Simulator,name=<simulator name>' build
xcodebuild -scheme BananaList -destination 'platform=iOS Simulator,name=<simulator name>' test
```

Prefer MCP tools (`build_sim`, `test_sim`) over raw commands.

## Key Patterns

### Observable + SwiftData

- SwiftData `@Model` classes are automatically Observable
- DO NOT add `@Observable` to `@Model` classes (redundant, causes warnings)
- Use `@Bindable` for two-way bindings to model properties in forms
- Use `@Query` in views, `modelContext.fetch()` in non-view code

### iCloud Sync

- Automatic via SwiftData CloudKit integration
- Conflict resolution: last-write-wins (CloudKit default)
- Sync status exposed via `CloudSyncManager.shared.syncState`
- Test sync by running on two simulators with same iCloud account

### MCP Server Architecture

- Runs over stdio: Claude Desktop starts it as a local process and exchanges JSON-RPC on stdin and stdout
- Exposes 6 tools: listAll, getList, createList, addItem, completeItem, deleteItem
- Ships as a `.mcpb` extension that Claude Desktop installs; a server added by hand goes in `~/Library/Application Support/Claude/claude_desktop_config.json`

## Rules

- NEVER modify .pbxproj or .xcodeproj contents
- NEVER change the model schema without updating SampleData.swift
- NEVER use `ObservableObject` — SwiftData models are already Observable
- NEVER use `@StateObject` — use `@State` with `@Observable` classes
- NEVER use `NavigationView` — always `NavigationStack`
- NEVER add `@Observable` macro to `@Model` classes
- ALWAYS use `@Bindable` for form bindings to model properties
- ALWAYS test iCloud sync changes on two simulator instances

Real CLAUDE.md: Reps (Minimal SwiftData App — 14 Files)

For small projects, the CLAUDE.md can be concise. Here is the pattern for Reps, a 14-file workout tracker. Notice how even a short CLAUDE.md covers all six essential sections:

# Reps - Workout Tracking

**Bundle ID:** `com.941apps.Reps`
**Target:** iOS 26+
**Architecture:** SwiftUI + SwiftData
**Swift version:** 6.2

## File Structure

```
Reps/
├── RepsApp.swift              # App entry, model container
├── Models/
│   ├── Workout.swift          # @Model: workout with exercises, date, duration
│   ├── Exercise.swift         # @Model: exercise with sets, reps, weight
│   └── ExerciseTemplate.swift # @Model: saved exercise definitions
├── Views/
│   ├── WorkoutListView.swift  # Main list of workouts
│   ├── WorkoutDetailView.swift # Exercises within a workout
│   ├── ExerciseRow.swift      # Single exercise with inline editing
│   ├── AddExerciseSheet.swift # Exercise selection from templates
│   ├── NewWorkoutView.swift   # Start new workout flow
│   └── StatsView.swift        # Progress charts and summaries
├── Managers/
│   └── WorkoutTimer.swift     # Active workout timer
└── Extensions/
    └── Date+Extensions.swift  # Formatting helpers
```

## Build & Test

```bash
xcodebuild -scheme Reps -destination 'platform=iOS Simulator,name=<simulator name>' build
xcodebuild -scheme Reps -destination 'platform=iOS Simulator,name=<simulator name>' test
```

## SwiftData Relationships

- `Workout` has many `Exercise` (cascade delete)
- `Exercise` has optional `ExerciseTemplate`
- `ExerciseTemplate` standalone (nullify on exercise delete)

## Rules

- NEVER modify .pbxproj
- NEVER use ObservableObject — use @Observable
- NEVER use NavigationView — use NavigationStack
- @Model classes are already Observable — do not add @Observable macro
- Use @Bindable for form bindings to model properties

That is 40 lines of CLAUDE.md for a 14-file project. It takes 10 minutes to write and saves hours of agent confusion.

Real CLAUDE.md: Starfield Destroyer (SpriteKit + Metal — 32 Files)

Game projects require more framework-specific context. The agent needs to understand the scene graph, physics categories, and game state machine:

# Starfield Destroyer - Space Shooter

**Bundle ID:** `com.941apps.StarfieldDestroyer`
**Target:** iOS 26+
**Architecture:** SpriteKit + Metal post-processing + Game Center
**Swift version:** 6.2

## Game Overview

99 levels across 3 galaxies. 8 unlockable ships with different stats.
Game Center leaderboards and achievements. Metal shader post-processing
for bloom and screen effects.

## File Structure

```
StarfieldDestroyer/
├── StarfieldDestroyerApp.swift    # App entry, Game Center auth
├── GameScene.swift                # Main game scene, update loop
├── MenuScene.swift                # Title screen, ship selection
├── Entities/
│   ├── PlayerShip.swift           # Player node with physics, weapons, shields
│   ├── EnemyShip.swift            # Enemy base class with AI behaviors
│   ├── Bullet.swift               # Bullet pool node
│   ├── PowerUp.swift              # Collectible power-ups
│   └── Boss.swift                 # Boss enemies (levels 33, 66, 99)
├── Systems/
│   ├── LevelManager.swift         # Level progression, wave spawning
│   ├── PhysicsCategory.swift      # UInt32 bitmask categories
│   ├── CollisionHandler.swift     # Contact delegate methods
│   ├── ScoreManager.swift         # Score tracking, multipliers
│   ├── ParticleManager.swift      # Explosion, trail, shield emitters
│   └── AudioManager.swift         # Sound effects, background music
├── UI/
│   ├── HUDNode.swift              # Score, health, level display
│   ├── ShipSelectView.swift       # SwiftUI ship selection (UIHostingController)
│   ├── GameOverView.swift         # Game over screen with score submission
│   └── PauseMenu.swift            # Pause overlay
├── Metal/
│   ├── MetalRenderer.swift        # Post-processing render pipeline
│   ├── BloomShader.metal          # Bloom post-process effect
│   └── ShaderTypes.h              # Shared uniforms (bridging header)
├── Data/
│   ├── ShipData.swift             # 8 ship definitions (speed, damage, shields)
│   ├── LevelData.swift            # 99 level configurations
│   └── AchievementData.swift      # Game Center achievement definitions
└── GameCenterManager.swift        # Leaderboard/achievement submission
```

## SpriteKit Scene Hierarchy

```
GameScene (SKScene)
├── backgroundLayer (zPosition: -100)
│   └── StarfieldNode (parallax scrolling, 3 layers)
├── gameLayer (zPosition: 0)
│   ├── playerShip (zPosition: 10)
│   ├── enemyContainer (zPosition: 5)
│   ├── bulletPool (zPosition: 8) — pre-allocated 50 bullets
│   └── powerUpContainer (zPosition: 3)
├── effectsLayer (zPosition: 50)
│   └── ParticleManager (explosion + trail emitters)
└── hudLayer (zPosition: 100)
    ├── scoreLabel (SKLabelNode)
    ├── healthBar (custom SKShapeNode)
    └── levelLabel (SKLabelNode)
```

## Physics Categories

```swift
struct PhysicsCategory {
    static let none:      UInt32 = 0
    static let player:    UInt32 = 0b1        // 1
    static let enemy:     UInt32 = 0b10       // 2
    static let bullet:    UInt32 = 0b100      // 4
    static let powerUp:   UInt32 = 0b1000     // 8
    static let shield:    UInt32 = 0b10000    // 16
    static let bossBullet:UInt32 = 0b100000   // 32
}

// Contact pairs:
// player + enemy → damage
// player + powerUp → collect
// bullet + enemy → destroy
// player + bossBullet → damage
```

## Game State Machine

```
.menu → .playing → .paused → .playing
                 → .gameOver → .menu
                 → .bossIntro → .playing
                 → .levelComplete → .playing (next level)
```

## Metal Post-Processing

- Bloom shader: `BloomShader.metal` — multi-pass Gaussian blur + additive blend
- Uniforms: `PostProcessUniforms { float intensity; float threshold; float2 resolution; }`
- Applied after SpriteKit renders each frame via `SKView.presentScene(:transition:)`
- DO NOT modify Metal shaders without testing on device

## Build & Test

```bash
xcodebuild -scheme StarfieldDestroyer -destination 'platform=iOS Simulator,name=<simulator name>' build
xcodebuild -scheme StarfieldDestroyer -destination 'platform=iOS Simulator,name=<simulator name>' test
```

## Rules

- NEVER modify .pbxproj
- NEVER modify PhysicsCategory bitmasks (breaks all collision detection)
- NEVER change the scene hierarchy z-ordering without understanding render order
- NEVER modify ShaderTypes.h without updating both Swift and Metal references
- Add new enemies by subclassing EnemyShip, not by modifying it
- Bullet pooling: recycle via removeFromParent() + re-add, never allocate new
- Game Center: always check isAuthenticated before submitting scores

Real CLAUDE.md: amp97 (Metal + Audio Visualization — 41 Files)

Metal projects need the most framework-specific context because agents cannot verify visual output:

# amp97 - Audio Visualizer

**Bundle ID:** `com.941apps.amp97`
**Target:** iOS 26+
**Architecture:** Metal render pipeline + AVAudioEngine analysis
**Swift version:** 6.2

## Architecture

```
Audio Input (microphone/file)
    → AVAudioEngine tap
    → FFT (vDSP)
    → Frequency/amplitude buffers
    → Metal compute shader (analysis)
    → Metal render pipeline (visualization)
    → CADisplayLink (60fps)
    → MTKView
```

## File Structure

```
amp97/
├── amp97App.swift               # App entry
├── Audio/
│   ├── AudioEngine.swift        # AVAudioEngine setup, tap installation
│   ├── FFTProcessor.swift       # vDSP FFT, frequency bin extraction
│   ├── AudioBuffer.swift        # Ring buffer for audio data
│   └── MicrophoneManager.swift  # Microphone permission, session config
├── Rendering/
│   ├── MetalView.swift          # MTKView wrapper for SwiftUI
│   ├── Renderer.swift           # Main render loop, pipeline state
│   ├── ShaderLibrary.swift      # Compiled shader management
│   ├── BufferManager.swift      # Triple-buffered uniform updates
│   └── TextureManager.swift     # Offscreen render targets
├── Shaders/
│   ├── Shaders.metal            # Vertex + fragment shaders
│   ├── AudioCompute.metal       # Audio analysis compute kernel
│   ├── PostProcess.metal        # Bloom, color grading
│   └── ShaderTypes.h            # Shared uniforms (bridging header)
├── Visualizations/
│   ├── WaveformViz.swift        # Oscilloscope-style waveform
│   ├── SpectrumViz.swift        # Frequency spectrum bars
│   ├── CircularViz.swift        # Radial visualization
│   └── VizSelector.swift        # Visualization switching
├── Views/
│   ├── MainView.swift           # Full-screen viz with overlays
│   ├── ControlsOverlay.swift    # Play/pause, viz selection, gain
│   └── SettingsView.swift       # Audio source, sensitivity
└── Extensions/
    ├── SIMD+Extensions.swift    # Vector math helpers
    └── Color+Metal.swift        # UIColor → float4 conversion
```

## Metal Pipeline

### Uniforms (ShaderTypes.h)
```c
typedef struct {
    float time;
    float2 resolution;
    float audioLevel;       // 0.0-1.0 RMS amplitude
    float frequencyBins[64]; // FFT output, normalized
    float4x4 transform;
} Uniforms;
```

### Render Pipeline
1. Compute pass: AudioCompute.metal processes FFT data → texture
2. Render pass: Shaders.metal reads texture + uniforms → visualization
3. Post-process pass: PostProcess.metal applies bloom → final output

### Buffer Management

- Triple buffering with DispatchSemaphore(value: 3)
- Uniforms updated per-frame on CPU, consumed by GPU 1-2 frames later
- Audio data ring buffer: 4096 samples, lock-free single producer/consumer

## Rules

- NEVER modify ShaderTypes.h without updating BOTH Swift and Metal sides
- NEVER exceed 64 frequency bins (fixed buffer size in shader)
- NEVER test Metal visual output in simulator — device only
- NEVER modify the audio engine tap format (48kHz, mono, float32)
- Triple buffer discipline: always signal semaphore in completion handler
- Audio session: .playAndRecord category with .defaultToSpeaker option

Scaling CLAUDE.md with Project Size

The right level of detail depends on file count and framework complexity:

Project Size CLAUDE.md Depth Example
Small (< 20 files) Identity + file list + rules Reps (14 files): basic SwiftData patterns, build commands, prohibitions
Medium (20-40 files) + Framework context + key patterns TappyColor (30 files): SpriteKit scene hierarchy, physics categories, game loop
Large (40+ files) + Architecture diagrams + relationship maps + multi-target info Return (63 files): cross-platform architecture, session sync diagram, per-platform differences
Specialized (Metal/GPU) + Pipeline diagrams + shared type definitions + buffer layouts amp97 (41 files): render pipeline stages, uniform struct, buffer management

The cost of over-documenting is near zero (the agent skips what it does not need). The cost of under-documenting is high (the agent invents patterns that conflict with your codebase).

CLAUDE.md Checklist

Use this checklist when creating or auditing a CLAUDE.md for an iOS project:

  • [ ] Bundle ID and deployment target specified
  • [ ] Swift version and architecture pattern named
  • [ ] File structure with inline purpose annotations
  • [ ] Build command with correct scheme and destination
  • [ ] Test command with correct scheme and destination
  • [ ] MCP preference noted (“prefer build_sim over xcodebuild”)
  • [ ] @Observable rule (never ObservableObject)
  • [ ] NavigationStack rule (never NavigationView)
  • [ ] .pbxproj prohibition
  • [ ] Framework-specific context (HealthKit permissions, SwiftData relationships, SpriteKit hierarchy, Metal pipeline)
  • [ ] Platform availability guards documented (#if canImport, #if os)
  • [ ] Key singletons and shared patterns documented
  • [ ] Known limitations or gotchas noted

Your First Agent Session

With MCP configured and a CLAUDE.md in your project, here is a walkthrough of an effective first session. This uses Claude Code CLI but the workflow applies to any runtime.

Step 1: Verify the Agent Can See Your Project

You: Summarize this project. What scheme should I build with?

Claude: [reads CLAUDE.md]
        [calls discover_projs via MCP]
        [calls list_schemes via MCP]

        This is Return, a zen meditation timer for iOS 26+, watchOS, and tvOS.
        Available schemes: Return, ReturnWatch, ReturnTV, ReturnTests.
        Primary scheme for iOS: Return.

If the agent does not reference your CLAUDE.md content, check that the file is in the project root (same directory as .xcodeproj or Package.swift).

Step 2: Run a Health Check Build

You: Build the Return scheme for iOS simulator and report results.

Claude: [calls list_sims — picks an available iPhone simulator]
        [calls boot_sim — boots the simulator]
        [calls build_sim — builds the project]

        Build succeeded. 63 source files compiled.
        2 warnings:
        - HomeView.swift:132 — UIScreen.main deprecated in iOS 26.0
        - LogWaterIntent.swift:61 — Result of try? is unused
        0 errors.

Step 3: Run Tests

You: Run all tests and report pass/fail.

Claude: [calls test_sim]

        12 tests executed:
        ✓ TimerManagerTests (5/5 passed)
        ✓ SettingsTests (4/4 passed)
        ✓ ConstantsTests (3/3 passed)
        All tests passed.

Step 4: Implement a Feature

You: Add a new "Rain" theme to the theme system. Follow the existing
     pattern in Theme.swift and ThemeManager.swift. Include a rain
     ambient sound. Build and test after implementation.

Claude: [reads Theme.swift — understands Theme struct pattern]
        [reads ThemeManager.swift — understands theme registration]
        [reads existing theme definitions]
        [adds Rain theme to Theme.swift following existing pattern]
        [registers Rain theme in ThemeManager.swift]
        [calls build_sim — build succeeds]
        [calls test_sim — all tests pass]

        Added Rain theme:
        - Theme.swift: new `static let rain` with video, cover, ambient
        - ThemeManager.swift: added to `allThemes` array
        - Build: success (0 errors, 2 existing warnings)
        - Tests: 12/12 passed

        Note: You'll need to add rain_ambient.wav to the project
        and add the new Theme.swift changes to the Xcode target manually
        (I did not modify .pbxproj).

The agent’s note about not modifying .pbxproj is the result of the rules in CLAUDE.md. Without that rule, the agent would attempt to modify the project file and likely corrupt it.


What Agents Do Well in iOS

These are the tasks where agents consistently produce correct, production-ready output with minimal human review.

SwiftUI Views and Modifiers

Agents have deep pattern recognition for SwiftUI declarative syntax. View composition, modifier chains, state bindings, and layout — these map well to the agent’s training data because SwiftUI’s API surface is well-documented and patterns are highly consistent.

Where agents excel:

  • Building new views from a description (“create a settings sheet with toggles for X, Y, Z”)
  • Applying modifier chains (.glassEffect(), .sensoryFeedback(), .navigationTitle())
  • Converting between layout patterns (VStack to LazyVGrid, List to ScrollView)
  • Implementing @Bindable form bindings to SwiftData models
  • Building preview providers with sample data

Example prompt that produces excellent results:

Create a SettingsView that matches the existing pattern in SettingsSheet.swift.
Include toggles for:

- Enable haptic feedback (Settings.shared.hapticsEnabled)
- Enable HealthKit logging (Settings.shared.healthKitEnabled)
- Show session history (navigation link to SessionHistoryView)

Use Liquid Glass styling with .glassEffect() on section backgrounds.
Follow the @Observable pattern, not ObservableObject.

The specificity matters. “Create a settings view” produces generic output. “Create a SettingsView that matches the existing pattern in SettingsSheet.swift” produces output consistent with your codebase.

SwiftData Models and Queries

Agents handle SwiftData’s @Model macro, relationships, and @Query patterns reliably. The framework’s declarative nature (similar to Django ORM or SQLAlchemy) maps well to patterns the agent has seen across many codebases.

Where agents excel:

  • Defining @Model classes with relationships
  • Writing @Query with sort descriptors and predicates
  • Implementing CRUD operations via modelContext
  • Migration plans between schema versions
  • Preview data and test fixtures

Where agents need guidance:

  • Complex #Predicate expressions (SwiftData’s predicate DSL has limitations that the agent does not always know about — document known limitations in CLAUDE.md)
  • CloudKit sync configuration (automatic via SwiftData, but the agent may try to implement manual sync)

Unit Tests

Agent-written unit tests are consistently high quality for iOS projects. The agent understands XCTest patterns, async test methods, and setup/teardown lifecycle.

Write unit tests for TimerManager covering:
1. Initial state is .stopped
2. start() transitions to .running
3. pause() transitions to .paused
4. reset() returns to .stopped with original duration
5. Timer counts down correctly (test with 3-second duration)

The agent produces well-structured XCTest cases with setUp() and tearDown(), appropriate assertions, and async handling for timer-based tests.

Refactoring and Pattern Application

Agents excel at mechanical refactoring: extracting views into components, converting ObservableObject to @Observable, migrating from NavigationView to NavigationStack, and applying consistent patterns across multiple files.

Refactor all views in the Views/ directory to use @Observable instead of
ObservableObject. Update @StateObject to @State, @ObservedObject to direct
property access, and @Published to plain properties.

The agent methodically works through each file, applies the transformation correctly, and maintains existing functionality. This is high-leverage work — a refactoring that would take an hour of manual editing completes in minutes with near-perfect accuracy.

Build Error Diagnosis via MCP

With structured MCP output, agents diagnose build errors faster than most developers. The agent reads the error JSON, identifies the exact file and line, understands the error message, and applies the fix — often in a single turn.

Errors agents fix autonomously:

  • Missing imports
  • Type mismatches
  • Protocol conformance gaps
  • Deprecated API usage (with replacement)
  • Missing required initializer parameters
  • Access control violations

Errors agents need help with:

  • Ambiguous type resolution (multiple modules define the same type)
  • Complex generic constraint failures
  • Macro expansion errors (the agent cannot see expanded macro output)

Simulator Management

Agents handle simulator lifecycle well via MCP:

Boot an available iPhone simulator, install the app, and take a screenshot.

The agent calls list_sims to find available runtimes, boot_sim to start the simulator, build_sim to build and install, and screenshot to capture — all through structured MCP calls.


What Agents Do Poorly in iOS

Honest accounting of where agents fail. Knowing these boundaries prevents frustration and wasted tokens.

.pbxproj File Modifications — Never

This is the single most important rule in iOS agent development. The .pbxproj file is Xcode’s project configuration — a structured text file with UUID references, build phase listings, and target membership. It is nominally human-readable but practically unparseable for AI agents.

Why agents fail at .pbxproj:

  • The file uses a custom format (not JSON, not YAML, not XML) with positional significance
  • Every entry is cross-referenced by UUID — adding a file requires updating 3-5 different sections consistently
  • A single misplaced character corrupts the entire project file
  • Xcode’s merge conflict resolution for .pbxproj is already fragile — agent edits make it worse

What happens when an agent edits .pbxproj: 1. The edit appears to succeed (the agent reports “file updated”) 2. Xcode refuses to open the project (“The project file is corrupted”) 3. You spend 15-60 minutes recovering from git history 4. You learn to add the PreToolUse hook (see Hooks)

The workflow: The agent creates Swift files. You add them to the Xcode project manually (drag into Xcode, or File > Add Files). This takes 5 seconds per file and prevents hours of recovery.

For Swift Package Manager projects: This limitation is less severe. Package.swift is a standard Swift file that agents can edit reliably. If your project uses SPM exclusively (no .xcodeproj), the agent can manage the full project structure.

What Xcode 27 changes, and what it does not. Two Apple-provided routes around hand-editing now exist. I have not shipped with either, so the rule above stands for my projects.

  • A JSON project format. The Xcode 27.2 release notes say: “Xcode now supports a JSON-based project format (.xcproj) that’s more readable, merge-friendly, and easier for coding agents to edit. Enable it in the File inspector. Projects using .xcproj also open in earlier versions of Xcode 27.” (184661114) Apple’s documentation adds that the file sits inside the same .xcodeproj package in place of the .pbxproj file, that “Xcode 27 and later supports both file formats,” that in Xcode 27.2 and later it is “the default project configuration file,” and that you switch a project created in an earlier release by choosing JSON from the Project Format pop-up menu in the File inspector. With source control, discarding the change undoes the switch.29 That is the extent of what Apple documents. Apple says the format is easier for agents to edit. It does not say agent edits are safe, and I have not tested any. A project you have not switched is still on .pbxproj, and everything above still applies to that file.
  • Project tools in Apple’s MCP server. On Xcode 27.2 the bridge lists XcodeNewTarget, AddEntitlement, AddInfoPlist, and UpdateTargetBuildSetting, and its XcodeWrite adds new files to the project structure.35 These change the project through Xcode, not through a text edit of the project file, which is the failure the manual workflow protects against. They need a running Xcode.

The hook in this guide blocks both formats, because .xcproj lives inside .xcodeproj/ and the pattern matches that directory. If you decide to let an agent edit a .xcproj file, change the hook on purpose, on a branch, with the project committed first.

Complex Interface Builder / Storyboard Edits

If your project uses Interface Builder (.xib files) or Storyboards (.storyboard files), agents cannot edit them meaningfully. These are XML files with auto-generated UUIDs, constraint references, and outlet connections that are designed for visual editing, not text editing.

The mitigation: Use SwiftUI exclusively for new views. If your project has legacy Interface Builder files, leave them alone and build new UI in SwiftUI.

Performance Optimization

Agents write correct code but not necessarily performant code. They cannot profile your app, identify bottlenecks, or measure frame rates. Performance optimization requires:

  1. Instruments profiling (a visual tool; xctrace gives agents a text route into a trace, see below)
  2. Understanding of the specific device’s GPU/CPU characteristics
  3. Iterative measurement-driven changes

Where this shows up:

  • Metal shader optimization (the agent writes valid Metal but cannot measure GPU frame time)
  • SwiftUI view body complexity (the agent creates deeply nested views that cause redraw overhead)
  • Core Data / SwiftData fetch optimization (the agent writes correct queries that may be slow on large datasets)

The mitigation: Use agents for implementation, profile manually with Instruments, then ask the agent to apply specific optimizations you have identified.

What the tools now give an agent: On Xcode 27.2, Apple’s MCP server gives an agent field data: GetTopFieldPerformanceIssues and GetFieldPerformanceIssueLogs cover launches, hangs, disk writes, and energy for a shipped app.35 The xctrace command line has a triage subcommand that reports the hangs in a recorded trace and a show subcommand for call trees, summaries, and lists, each with text or Markdown output. Apple’s release notes list these under the Xcode 27.3 beta, along with two Apple specialists that teach agents to use them; on my Mac the xctrace in Xcode 27.2 already has both subcommands, and the plugin directory already holds an xctrace skill.2739 I have not run a profiling loop through either, so the mitigation above is still how I work.

Code Signing and Provisioning

Agents cannot debug code signing issues beyond reading the error message. Provisioning profile management, certificate creation, entitlement configuration, and App Store submission are fundamentally human-operated workflows that involve the Apple Developer portal, Keychain Access, and Xcode’s signing UI.

What the agent sees: “Signing for ‘Return’ requires a development team.”

What the agent cannot see: Whether your certificate expired, whether the provisioning profile includes the device, whether the bundle ID matches the App ID, or whether your entitlements file is correct.

The mitigation: Handle all signing in Xcode’s Signing & Capabilities tab. Do not ask agents to debug signing failures.

Complex Metal Shader Debugging

Agents write syntactically correct Metal Shading Language (MSL) but cannot verify visual output or debug GPU-side issues. Metal shaders execute on the GPU — the agent has no feedback mechanism for whether the shader produces correct visual results.

What agents can do with Metal:

  • Write vertex and fragment shaders from descriptions
  • Set up the Metal render pipeline in Swift
  • Create compute shaders for data-parallel operations
  • Fix compilation errors in .metal files

What agents cannot do with Metal:

  • Verify visual correctness of shader output
  • Debug GPU performance (frame time, occupancy, memory bandwidth)
  • Diagnose visual artifacts (banding, precision issues, incorrect color space)
  • Test on different GPU architectures (A-series vs. M-series behavior differences)

The mitigation: Test Metal shaders on physical devices. The Simulator’s Metal implementation is not representative of device GPU behavior. Use Xcode’s GPU Frame Capture for visual debugging.

Visual Layout Verification

Agents cannot see your app’s UI. They write SwiftUI layout code and can verify it compiles, but they cannot tell whether the resulting screen looks correct. A view that renders 10 pixels off-center, uses the wrong font weight, or has overlapping elements produces no build error and passes all logic tests.

The mitigation: Review UI changes visually. Use SwiftUI Previews in Xcode (or RenderPreview via Apple MCP for headless rendering) to verify layout. Consider snapshot testing with libraries like swift-snapshot-testing for automated visual regression detection.

What the 2026 tools add: both servers can now hand the agent a picture. MobileBuildMCP’s screenshot returns a capture and snapshot_ui returns the screen’s elements with stable references, and on Xcode 27 Apple’s DeviceInteractionSynthesize returns a screenshot and UI hierarchy after each synthesized tap or swipe.2635 That lets an agent confirm a button exists, a label reads correctly, and a flow completes. It does not make the agent a judge of whether the screen looks right, and I still review every UI change myself.


Hooks for iOS Development

Hooks are shell commands that execute deterministically at specific points in the agent’s workflow. They are the enforcement mechanism — the difference between “please do not edit .pbxproj” (a suggestion the agent may ignore) and a tool call that is refused before it runs. A hook covers the tools its matcher names and nothing else, so each example below says which tools it covers.

For background on the hook system, see the Claude Code hooks guide. This section covers iOS-specific hook patterns.

PreToolUse: Block .pbxproj Writes

The most important hook in any iOS project. The first matcher group stops the Edit and Write tools from writing to .pbxproj files, .xcodeproj/ directories, and other Xcode-managed files. The second stops a Bash command that names one of those paths:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); FP=$(echo \"$INPUT\" | jq -r \".tool_input.file_path // empty\"); if echo \"$FP\" | grep -qE \"\\.(pbxproj|xcworkspace|xib|storyboard)$|xcodeproj/|xcworkspace/\"; then echo \"BLOCKED: Do not modify Xcode project files. Create Swift files and add to Xcode manually.\" >&2; exit 2; fi'"
          }
        ]
      },
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); CMD=$(echo \"$INPUT\" | jq -r \".tool_input.command // empty\"); if echo \"$CMD\" | grep -qE \"\\.(pbxproj|xib|storyboard)|xcodeproj/|xcworkspace/\"; then echo \"BLOCKED: This command names an Xcode-managed file. Do not modify Xcode project files from the shell.\" >&2; exit 2; fi'"
          }
        ]
      }
    ]
  }
}

Place this in .claude/settings.json at the project root or in ~/.claude/settings.json for global protection.

Each entry has three levels: the event (PreToolUse), a matcher group that picks the tools, and a hooks array of handlers, each with "type": "command".33

How it works: When the agent calls the Edit or Write tool on a matching path, or runs a Bash command whose text contains one, the hook prints a message to stderr and exits with code 2, which blocks the tool call. The agent receives the message and adjusts its approach.33

What it catches:

  • Direct .pbxproj edits
  • Any file inside .xcodeproj/ or .xcworkspace/ directories
  • Interface Builder files (.xib, .storyboard)
  • Shell commands that name any of those paths, such as a sed -i on project.pbxproj

What it does not catch:

  • A Bash command that reaches the file without naming it, such as a script that builds the path at run time. The Bash group matches on the command text and nothing else.
  • The difference between reading and writing in a shell command. The Bash group refuses cat on a project file as well as sed -i, and git commands that name one. The Read tool is not matched, so the agent can still read the file with it.
  • A shell command that names the project bundle with no trailing slash. The Bash pattern looks for xcodeproj/ and xcworkspace/, which is what lets xcodebuild -project Return.xcodeproj run, and for the same reason rm -rf Return.xcodeproj and mv Return.xcodeproj Old.xcodeproj run too. To refuse those, append one more alternative to the Bash group’s pattern, written here as it sits inside the JSON string: |(^|[[:space:];&|])(rm|mv|cp)[[:space:]][^]|;&]*\\.(xcodeproj|xcworkspace). It matches rm, mv, or cp as a whole word with a bundle name later in the same command, git rm and git mv included, and still lets xcodebuild -project and xcodebuild -workspace through.
  • MCP file tools. Apple’s XcodeWrite, XcodeUpdate, XcodeMV, and XcodeRM are separate tools with their own names (mcp__xcode__XcodeWrite and so on), and neither matcher names them.
  • Xcode’s own agents, which do not run your Claude Code hooks.

Claude Code’s permission rules add a second layer for shell commands. An Edit deny rule such as Edit(*.pbxproj) in permissions.deny covers the built-in file tools and, in a Bash command Claude Code can analyze, “redirection targets” and the “file commands it recognizes, such as cat, head, tail, sed, and tee.” The same page says deny rules do not apply to “a Python or Node script that opens files itself,” so the gap in the first bullet stays open either way.36

PostToolUse: Format-on-Save with SwiftFormat

Automatically format Swift files whenever the agent writes or edits them:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); FP=$(echo \"$INPUT\" | jq -r \".tool_input.file_path // empty\"); if echo \"$FP\" | grep -qE \"\\.swift$\"; then swiftformat \"$FP\" --quiet 2>/dev/null; fi'"
          }
        ]
      }
    ]
  }
}

Requirements: SwiftFormat must be installed (brew install swiftformat).

Why this matters: Agents produce syntactically correct Swift but do not consistently follow formatting conventions. SwiftFormat normalizes indentation, brace placement, and import ordering.8 The format-on-save hook means every Swift file the agent writes with the Edit or Write tool is formatted before you see it.

Optional: Add a .swiftformat configuration file to your project root to customize formatting rules:

# .swiftformat
--indent 4
--allman false
--stripunusedargs closure-only
--importgrouping testable-bottom
--header strip

PostToolUse: Auto-Run SwiftLint

If you use SwiftLint, run it on each Swift file the agent edits and hand the findings back:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); FP=$(echo \"$INPUT\" | jq -r \".tool_input.file_path // empty\"); if echo \"$FP\" | grep -qE \"\\.swift$\"; then OUT=$(swiftlint lint --quiet --force-exclude \"$FP\" 2>&1 | grep -v \"No lintable files found\"); if [ -n \"$OUT\" ]; then echo \"$OUT\" >&2; exit 2; fi; fi'"
          }
        ]
      }
    ]
  }
}

Four details decide whether this hook does anything useful:

  • The file is a positional argument. SwiftLint deprecated --path in 0.48.0 and removed it in 0.56.0, so swiftlint lint --path <file> fails on current releases.37
  • The excluded list is honored. SwiftLint lints a file passed by explicit path even when the configuration’s excluded list covers it, so without --force-exclude an edit to a generated or vendored file sends its violations back to the agent. With the flag, a run whose only file is excluded stops with the error No lintable files found at paths, unless the configuration sets allow_zero_lintable_files: true. The grep -v drops that one line, and the edit passes in silence.37
  • Findings go to stderr with exit code 2. A PostToolUse hook that prints to stdout and exits 0 tells the agent nothing: Claude Code adds plain-text stdout to Claude’s context on a few events, and PostToolUse is not one of them. The hooks reference gives the route: “To surface a warning to Claude from a PostToolUse or PostToolUseFailure hook, exit 2 instead so Claude sees the stderr even though the tool already ran.” The edit stays in place and the agent reads the violations next to the tool result.33
  • Nothing is discarded. 2>&1 folds SwiftLint’s own errors (a bad configuration file, a missing binary) into the same message, so a broken lint setup is reported instead of passing silently.

With --quiet, SwiftLint prints violations and no status lines, so any output means there is something to report, and warnings and errors are both sent back. To send back errors only, test SwiftLint’s exit status instead of its output: it exits with status 2 when serious violations remain, and --strict upgrades warnings to serious ones.37 The hooks reference also documents a JSON route for the same feedback: exit 0 and print an object with "decision": "block" and a reason, or with hookSpecificOutput.additionalContext.33

PostToolUse: Auto-Build After Changes

For aggressive feedback loops, trigger a build after every Swift file change and return the errors when it fails:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); FP=$(echo \"$INPUT\" | jq -r \".tool_input.file_path // empty\"); if echo \"$FP\" | grep -qE \"\\.swift$\"; then if ! OUT=$(xcodebuild -quiet -scheme Return -destination \"platform=iOS Simulator,name=<simulator name>\" build 2>&1); then echo \"$OUT\" | tail -30 >&2; exit 2; fi; fi'"
          }
        ]
      }
    ]
  }
}

Replace Return with your scheme and <simulator name> with a device from xcrun simctl list devices available. -quiet limits xcodebuild’s output to warnings and errors, so the last 30 lines of a failed build are its diagnostics. A successful build exits 0 and adds nothing to the conversation. A failed build exits 2 with those lines on stderr, which is the part Claude Code shows to the agent.3339

Warning: This is expensive. Every file edit triggers a build. Use sparingly — it is most useful during debugging sessions where you want immediate build feedback. For normal development, let the agent trigger builds manually via MCP when it is ready.

PreToolUse: Block Entitlement Modifications

Keep the Edit and Write tools off your entitlements file:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); FP=$(echo \"$INPUT\" | jq -r \".tool_input.file_path // empty\"); if echo \"$FP\" | grep -qE \"\\.entitlements$\"; then echo \"BLOCKED: Do not modify entitlements files without explicit permission.\" >&2; exit 2; fi'"
          }
        ]
      }
    ]
  }
}

Combined iOS Hook Configuration

Here is the full .claude/settings.json I use across all iOS projects:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); FP=$(echo \"$INPUT\" | jq -r \".tool_input.file_path // empty\"); if echo \"$FP\" | grep -qE \"\\.(pbxproj|xcworkspace|xib|storyboard|entitlements)$|xcodeproj/|xcworkspace/\"; then echo \"BLOCKED: Do not modify Xcode-managed files. Create Swift files and add manually.\" >&2; exit 2; fi'"
          }
        ]
      },
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); CMD=$(echo \"$INPUT\" | jq -r \".tool_input.command // empty\"); if echo \"$CMD\" | grep -qE \"\\.(pbxproj|xib|storyboard|entitlements)|xcodeproj/|xcworkspace/\"; then echo \"BLOCKED: This command names an Xcode-managed file. Do not modify Xcode-managed files from the shell.\" >&2; exit 2; fi'"
          }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); FP=$(echo \"$INPUT\" | jq -r \".tool_input.file_path // empty\"); if echo \"$FP\" | grep -qE \"\\.swift$\"; then swiftformat \"$FP\" --quiet 2>/dev/null; fi'"
          }
        ]
      }
    ]
  }
}

This gives you two things: 1. The Edit and Write tools, and Bash commands that name those paths, are refused on Xcode-managed files (PreToolUse block). The limits listed under PreToolUse: Block .pbxproj Writes still apply. 2. Every Swift file the agent writes with Edit or Write is formatted afterward (PostToolUse format). The hooks reference notes that a PostToolUse hook matching Edit|Write does not run when a Bash command rewrites the file.33


Architecture Patterns That Work with Agents

Not all Swift architectures are equally agent-friendly. These patterns produce the best results because they are explicit, consistent, and well-represented in training data.

@Observable (Never ObservableObject)

iOS 26+ targets should use @Observable exclusively. This is both the modern pattern and the agent-friendly pattern:

// CORRECT — @Observable
@Observable
@MainActor
final class TimerManager {
    var timeRemaining: TimeInterval = 0
    var state: TimerState = .stopped

    func start() {
        state = .running
        // ...
    }
}

// In a view:
struct TimerView: View {
    @State private var timer = TimerManager()

    var body: some View {
        Text(timer.timeRemaining, format: .number)
    }
}
// WRONG — ObservableObject (deprecated pattern)
class TimerManager: ObservableObject {
    @Published var timeRemaining: TimeInterval = 0
    @Published var state: TimerState = .stopped
}

// WRONG — @StateObject (deprecated pattern)
struct TimerView: View {
    @StateObject private var timer = TimerManager()
}

Why @Observable is agent-friendly: The pattern is simpler (no @Published annotations needed), the ownership model is clearer (@State instead of @StateObject vs. @ObservedObject), and agents produce fewer bugs with it because there are fewer moving parts.

Document this in CLAUDE.md: Even with iOS 26 as the target, agents occasionally revert to ObservableObject patterns from their training data. Explicit prohibition prevents this.

// CORRECT
NavigationStack {
    List(items) { item in
        NavigationLink(value: item) {
            ItemRow(item: item)
        }
    }
    .navigationDestination(for: Item.self) { item in
        ItemDetailView(item: item)
    }
}

// WRONG
NavigationView {
    List(items) { item in
        NavigationLink(destination: ItemDetailView(item: item)) {
            ItemRow(item: item)
        }
    }
}

NavigationStack is iOS 16+ and the only navigation pattern you should use for new code. The type-safe navigationDestination(for:) pattern prevents the agent from creating incorrect navigation links.

SwiftData for Persistence

SwiftData models are the cleanest persistence pattern for agent-assisted development:

@Model
final class GroceryItem {
    var name: String
    var quantity: Int
    var isCompleted: Bool
    var category: Category?
    var list: GroceryList?

    init(name: String, quantity: Int = 1) {
        self.name = name
        self.quantity = quantity
        self.isCompleted = false
    }
}

Key rules for agents working with SwiftData: 1. @Model classes are automatically Observable — do not add @Observable 2. Use @Bindable for form bindings: @Bindable var item: GroceryItem 3. Use @Query in views for reactive data: @Query var items: [GroceryItem] 4. Use modelContext.fetch() in non-view code 5. Relationship deletions need explicit rules: .cascade, .nullify, .deny

Swift 6.2 Concurrency

Target Swift 6.2 strict concurrency for new projects. This is a language-mode choice, not a toolchain version — the Swift 6.3 compiler in Xcode 26.6 and the Swift 6.4 compiler in Xcode 27 both build these patterns unchanged:1718

// Actor isolation for shared mutable state
@MainActor
@Observable
final class DataManager {
    var items: [Item] = []

    func loadItems() async throws {
        let fetched = try await api.fetchItems()
        items = fetched  // Safe: @MainActor isolated
    }
}

// Sendable conformance for cross-actor transfers
struct Item: Sendable, Identifiable {
    let id: UUID
    let name: String
    let createdAt: Date
}

Agent guidance for concurrency:

  • Mark all view models @MainActor (prevents data race warnings)
  • Use async/await for all asynchronous work (no completion handlers)
  • Make value types Sendable for cross-actor transfers
  • Use Task { } in views for async initialization
  • Use nonisolated only when you have measured a performance need

Liquid Glass Design System (iOS 26+)

iOS 26 introduced the Liquid Glass design system. Agents handle it well when given explicit guidance:

// Glass effect on containers
VStack {
    // content
}
.glassEffect()

// Glass effect with tint
Button("Action") { }
    .glassEffect(.regular.tint(.blue))

// Glass effect on navigation bars (automatic in iOS 26)
NavigationStack {
    // content
}
// Navigation bar automatically uses glass material

// Custom glass shapes
RoundedRectangle(cornerRadius: 16)
    .fill(.ultraThinMaterial)
    .glassEffect()

Include in CLAUDE.md: “Use .glassEffect() on section backgrounds and card containers. Navigation bars automatically adopt glass material in iOS 26. Do not manually recreate glass effects with custom materials — use the system modifier.”


Framework-Specific Context

Each Apple framework has agent-specific considerations. This section covers the frameworks used across the 8 apps.

HealthKit

Apps using it: Return, Water

HealthKit requires careful permission handling and platform guards:

// Always check availability and authorization
import HealthKit

@MainActor
@Observable
final class HealthKitManager {
    private let store = HKHealthStore()
    var isAuthorized = false

    func requestAuthorization() async {
        guard HKHealthStore.isHealthDataAvailable() else { return }

        let types: Set<HKSampleType> = [
            HKQuantityType(.dietaryWater),
            HKCategoryType(.mindfulSession)
        ]

        do {
            try await store.requestAuthorization(toShare: types, read: types)
            isAuthorized = true
        } catch {
            // User denied — do not retry automatically
        }
    }
}

Agent rules for HealthKit:

  • Always guard with HKHealthStore.isHealthDataAvailable()
  • Never assume authorization — check on every write
  • Use #if canImport(HealthKit) for multi-platform code (HealthKit unavailable on tvOS)
  • Never store health data locally beyond what HealthKit provides
  • Include both NSHealthShareUsageDescription and NSHealthUpdateUsageDescription in Info.plist

SpriteKit

Apps using it: TappyColor, Starfield Destroyer

SpriteKit’s scene graph model requires explicit agent guidance:

## SpriteKit Rules

- Scene hierarchy is a tree of SKNodes with zPosition ordering
- Physics bodies use category bitmasks (UInt32) for collision detection
- Node pooling: pre-allocate reusable nodes (bullets, particles)
- Never add nodes directly to the scene — use layer nodes for organization
- Update loop: `update(_ currentTime:)` runs every frame — keep it fast
- Actions: use SKAction sequences for animations, not manual property updates
- Textures: use texture atlases for performance (.atlas directories)

Agent strengths with SpriteKit:

  • Creating SKAction sequences and groups
  • Setting up physics bodies and contact detection
  • Implementing game state machines
  • Building HUD overlays

Agent weaknesses with SpriteKit:

  • Performance-sensitive game loops (the agent adds unnecessary work per frame)
  • Complex physics simulations (custom physics beats SKPhysicsBody for precision)
  • Particle effect tuning (visual, requires iteration)

Metal

Apps using it: amp97, Water, Starfield Destroyer

Metal is the framework where agents struggle most. The GPU programming model is fundamentally different from CPU-side Swift, and agents cannot verify visual output.

## Metal Rules

- Shared types between Swift and Metal go in a bridging header (ShaderTypes.h)
- Triple buffer in-flight frames (semaphore with value 3)
- Test shaders on DEVICE, not simulator (Metal behavior differs)
- Compute shaders: threadgroup size must divide evenly into grid size
- Fragment shaders: output color must be in correct color space (sRGB or linear)
- DO NOT optimize shaders without Instruments GPU profiling data

What to include in CLAUDE.md for Metal projects:

  • The Uniforms struct definition (shared between Swift and MSL)
  • The render pipeline state setup pattern
  • Buffer indices and their purposes
  • Which shaders exist and what each does
  • Known precision issues (half vs. float)

Live Activities

Apps using it: Return

Live Activities require specific configuration that agents handle well once documented:

## Live Activities

- ActivityAttributes defined in `TimerActivityAttributes.swift`
- ActivityKit framework: `import ActivityKit`
- Widget extension: `ReturnWidgets/ReturnLiveActivity.swift`
- Start: `Activity<TimerActivityAttributes>.request(attributes:content:)`
- Update: `activity.update(ActivityContent(state:staleDate:))`
- End: `activity.end(ActivityContent(state:staleDate:), dismissalPolicy:)`
- Push token: register for updates via `activity.pushTokenUpdates`

Game Center

Apps using it: Starfield Destroyer

## Game Center

- Authentication: `GKLocalPlayer.local.authenticateHandler`
- Leaderboards: `GKLeaderboard.submitScore(_:context:player:leaderboardIDs:completionHandler:)`
- Achievements: `GKAchievement.report(_:withCompletionHandler:)` (takes `[GKAchievement]` array)
- Always check `GKLocalPlayer.local.isAuthenticated` before submitting
- Handle authentication failure gracefully (offline play must work)

Multi-Platform Patterns

Return spans iOS, watchOS, and tvOS. Multi-platform development with agents requires explicit platform boundary documentation.

Shared Code Organization

Shared/
├── MeditationSession.swift    # Data model (all platforms)
├── SessionStore.swift         # iCloud sync (all platforms)
└── SessionHistoryView.swift   # UI (adapts per platform)

Return/                        # iOS-specific
ReturnWatch Watch App/         # watchOS-specific
ReturnTV/                      # tvOS-specific

Rule for agents: “If a file is in Shared/, changes affect all platforms. If a file is in a platform directory, changes are isolated. Always check which directory a file is in before modifying it.”

Platform Availability Guards

// HealthKit: available on iOS and watchOS, not tvOS
#if canImport(HealthKit)
import HealthKit
// HealthKit code here
#endif

// ActivityKit: available on iOS only
#if canImport(ActivityKit)
import ActivityKit
// Live Activity code here
#endif

// WatchKit: available on watchOS only
#if os(watchOS)
import WatchKit
// Watch-specific code here
#endif

Agent guidance: “Always use #if canImport() or #if os() guards when using platform-specific frameworks. Do not assume a framework is available on all targets.”

Per-Platform UI Adaptation

struct SessionHistoryView: View {
    @Query var sessions: [MeditationSession]

    var body: some View {
        List(sessions) { session in
            SessionRow(session: session)
        }
        #if os(tvOS)
        .focusable()
        #endif
        #if os(iOS)
        .swipeActions {
            Button("Delete", role: .destructive) {
                // delete
            }
        }
        #endif
    }
}

Advanced Workflows

Autonomous Build-Test-Fix Loops

The most powerful pattern: give the agent a feature specification and let it iterate through build-test-fix cycles autonomously.

Implement a countdown timer that:
1. Starts from a user-selected duration (10, 20, or 30 minutes)
2. Shows remaining time with a circular progress indicator
3. Plays a bell sound on completion
4. Logs the session to HealthKit as mindful minutes

Build after each change. Fix all errors. Run tests when the build succeeds.
Continue until all tests pass and the build is clean.

The agent writes code, builds via MCP, reads structured errors, fixes them, and repeats. A feature that would require 5-10 human build-error-fix cycles completes in a single autonomous loop.

When this works: Well-defined features with clear acceptance criteria.

When this breaks: Open-ended features (“make it look nice”), performance-sensitive code, or anything requiring visual verification.

Subagent Delegation for iOS

Claude Code’s subagent system works for iOS projects:

Use a subagent to research the best approach for implementing
iCloud key-value store sync for meditation sessions across iOS,
watchOS, and tvOS. Report back with the recommended pattern.

The subagent explores documentation and code patterns in a separate context window, returns a summary, and the main session implements the recommendation. This prevents research from consuming your primary context.

Cross-App Pattern Application

When you maintain multiple iOS apps with consistent patterns, agents can apply patterns from one app to another:

Look at how Settings.swift works in the Return project
(centralized singleton with validation). Apply the same pattern
to create a Settings.swift for the Water project.

The agent reads the source pattern, understands the structure, and creates a consistent implementation in the target project.

Dual-Agent Review (Claude + Codex)

For critical changes, use two agents from different model families:

  1. Claude Code writes the implementation
  2. Codex CLI reviews it in a separate pass
# After Claude implements the feature:
codex "Review the changes in the last commit. Focus on Swift 6.2
      concurrency correctness, SwiftData relationship integrity,
      and potential retain cycles. Report issues only — no praise."

Different model families catch different classes of errors. This is especially valuable for Metal shaders and concurrency patterns where subtle bugs are easy to introduce.

What dual review catches that single review misses:

Issue Type Claude Strength Codex Strength
SwiftData relationship cycles Moderate Strong
@MainActor isolation gaps Strong Moderate
Metal buffer alignment Moderate Moderate
Retain cycle detection Strong (Opus) Strong
API deprecation awareness Strong (newer training data) Moderate
Concurrency race conditions Strong Strong (different patterns caught)

These ratings are my impressions from reviews run through mid-2026 on the models of the time, not a benchmark of the current GPT-6.2 or Opus 5.5 models. The dual review is not about finding more bugs — it is about finding different bugs. Each model family has different failure modes in its pattern recognition.

Batch Operations Across Multiple Apps

When a framework or pattern change affects multiple apps:

# Update @Observable pattern across all projects
for project in BananaList Return Water Reps; do
  cd ~/Projects/$project
  claude -p "Audit all files for any remaining ObservableObject usage.
             Convert to @Observable following the pattern in CLAUDE.md.
             Build and test after changes." \
    --permission-mode acceptEdits \
    --allowedTools "mcp__MobileBuildMCP__*"
done

Pre-approve what the run needs, and nothing else. A claude -p run has nobody to answer a permission prompt, so a call that needs approval is denied unless something approves it first. The two flags do that. --permission-mode acceptEdits lets Claude create and edit files in the working directory. The mode is wider than its name: it also auto-approves the filesystem Bash commands mkdir, touch, rm, rmdir, mv, cp, and sed on paths inside the working directory, so this unattended run can delete and move project files as well as edit them. --allowedTools "mcp__MobileBuildMCP__*" approves every tool from the MobileBuildMCP server, which is how the run builds and tests; name single tools (mcp__MobileBuildMCP__build_sim, mcp__MobileBuildMCP__test_sim) for a tighter grant. File reads inside the project need no approval. Any other call that would need your approval, a git push for example, is denied.36

--dangerously-skip-permissions is not required for non-interactive runs, and this loop should not use it. Claude Code’s documentation reserves that mode for “isolated environments like containers, VMs, or dev containers without internet access, where Claude Code cannot damage your host system.” Four unattended sessions in real project folders on your own Mac are the opposite case. For a grant that holds to the heading above, swap the two flags for --permission-mode dontAsk --allowedTools "Edit,mcp__MobileBuildMCP__*". An Edit rule covers every built-in tool that edits files, file reads in the project and Claude Code’s read-only commands still run, and every other call that would have prompted is denied, rm and mv among them.36

A -p session still runs the hooks in your settings, so the .pbxproj hook applies to this loop too.36

Apps That Use Apple’s On-Device LLM

If your app calls Apple’s Foundation Models framework (e.g. for offline summarization, classification, or structured-output generation), agents need to know the prompt budget. iOS 26.4 added two APIs to SystemLanguageModel so code no longer hardcodes the 4096-token limit: contextSize (max tokens the model accepts in a single conversation) and tokenCount(for:) (async throws, returns how many tokens a given prompt actually costs).45 In the iOS 27.2 SDK, contextSize is marked @backDeployed(before: iOS 26.4), so it is callable back to iOS 26.0. tokenCount(for:) is available from iOS 26.4 and is not back-deployed, so code that must run on an earlier release needs an availability check around it.45

The pattern an agent should follow when generating prompt-construction code:

import FoundationModels

@available(iOS 26.4, macOS 26.4, visionOS 26.4, *)
func budgetFor(prompt: String, reservedReply: Int = 256) async throws -> Int {
    let model = SystemLanguageModel.default
    let promptCost = try await model.tokenCount(for: prompt)
    let budget = model.contextSize - promptCost - reservedReply
    guard budget > 0 else { throw ContextError.promptTooLong }
    return budget
}

Add this pattern to your CLAUDE.md if the app touches SystemLanguageModel. Without it, agents hardcode 4096. That is the current maximum, and reading contextSize keeps the code from depending on it. The async throws signature on tokenCount(for:) is load-bearing — agents that paste a synchronous version will fail to compile.


Real-World Case Studies

Abstract advice is easy. Here are specific scenarios from the 8 apps that illustrate how agent-assisted iOS development works in practice — including the failures.

Case Study 1: Adding a TV App to Return (Success)

The task: Add a tvOS target to Return, a meditation timer that already had iOS and watchOS versions. The TV app needed Siri Remote navigation, large-screen UI, and settings sync with the iOS app.

What the agent did well:

  • Read the existing iOS TimerManager and created a TVTimerManager that omitted Live Activities and HealthKit (unavailable on tvOS)
  • Created custom button styles for Siri Remote focus navigation (TVCapsuleButtonStyle, TVCircleButtonStyle)
  • Built a TVStepper component that replaces wheel pickers (not usable with Siri Remote) with +/- buttons
  • Implemented settings sync via App Groups (group.com.941apps.Return)
  • Added #if os(tvOS) guards throughout shared code
  • Built and tested via MCP with platform=tvOS Simulator,name=Apple TV

What I had to do manually:

  • Create the tvOS target in Xcode (File > New > Target > tvOS App)
  • Add the new target to the Xcode project (.pbxproj changes)
  • Configure App Groups entitlement for the TV target
  • Add the TV target to the existing scheme or create a new one
  • Manually add all the agent-created Swift files to the TV target
  • Test Siri Remote navigation by hand (the agent cannot evaluate focus behavior)

Result: 15 new Swift files, fully functional TV app, in approximately 3 hours of agent-assisted work. By my estimate, the agent handled roughly 80% of the implementation work; I handled the parts that required Xcode UI interaction (entitlements, target setup, capability flags) and manual focus testing on a real Apple TV. Equivalent solo work in this codebase — based on similar features I’ve shipped without agents — would have been a multi-day effort.

Case Study 2: Metal Shader Debugging in amp97 (Partial Failure)

The task: Add an energy-based intensity system to the oscilloscope shader. The visualization should pulse with audio energy.

What happened: 1. The agent wrote a valid Metal shader modification adding a uEnergy uniform and HDR tonemapping 2. The code compiled without errors 3. On device, the visualization was completely white — the intensity coefficient was 10x too high (3.5 instead of 0.30) 4. The agent could not see the white screen, so it had no feedback signal 5. I identified the issue visually and asked the agent to reduce the coefficient 6. The agent reduced it, but the overall energy state machine was too complex and broke the visualizer in different ways 7. Reverted entirely — two commits (67959ed and cda4830) reverted in 869d914

The lesson: Metal shaders are the hardest domain for agent-assisted development because the feedback loop is broken. The agent can verify syntax (compiles) and semantics (correct types) but cannot verify output (looks right). Any shader modification that changes visual behavior requires human verification on device.

What I added to CLAUDE.md after this: “DO NOT attempt energy state modifications to the oscilloscope shader without extremely careful coefficient testing. Previous attempt broke the visualizer with coefficients 10x too high.”

Case Study 3: SwiftData Migration in Banana List (Success)

The task: Migrate the data model from V1 to V2, adding a quantity field to GroceryItem and a new Category model with relationships.

What the agent did: 1. Read the existing V1 model definitions 2. Created V2 model definitions with the new fields and relationships 3. Wrote a GroceryMigrationPlan with SchemaMigrationPlan protocol conformance 4. Implemented the V1toV2 migration stage: added default quantity: 1 and category: nil 5. Updated all views to support the new fields 6. Updated SampleData.swift for previews 7. Built and ran tests via MCP — all passed 8. Created migration-specific unit tests

The key: The agent succeeded because SwiftData migrations follow a well-defined protocol pattern that is thoroughly represented in Apple’s documentation and training data. The CLAUDE.md explicitly documented the V1 model, so the agent understood what it was migrating from.

Case Study 4: iCloud Session Sync in Return (Success with Complexity)

The task: Implement cross-device meditation session logging. Sessions completed on Apple TV or Mac should sync to iPhone for HealthKit logging.

What the agent produced:

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│    tvOS     │     │    Mac      │     │   Watch     │
│ TVTimerMgr  │     │ TimerMgr    │     │ WatchTimer  │
└──────┬──────┘     └──────┬──────┘     └──────┬──────┘
       │                   │                   │
       └───────────────────┼───────────────────┘
                           │
                           ▼
              ┌────────────────────────┐
              │     SessionStore       │
              │  (iCloud Key-Value)    │
              └───────────┬────────────┘
                          │
                          ▼
              ┌────────────────────────┐
              │  iPhone (on foreground)│
              │  → Write to HealthKit  │
              └────────────────────────┘

The agent: 1. Created MeditationSession data model with UUID, dates, duration, source device, and HealthKit sync status 2. Built SessionStore singleton managing NSUbiquitousKeyValueStore for iCloud sync 3. Implemented merge conflict resolution (UUID-based deduplication) 4. Added SessionHistoryView with platform-specific adaptations (swipe-to-delete on iOS, focus-based on tvOS) 5. Wired iPhone-side HealthKit sync for sessions from other devices

What required iteration: The initial implementation did not handle the case where iPhone app launches in the background (no foreground notification for sync). The agent needed specific guidance: “Use NSUbiquitousKeyValueStore.didChangeExternallyNotification to trigger sync on background KV changes.” After that hint, the implementation was correct.

The lesson: Agents handle multi-platform architectural patterns well when the architecture is clearly described. The iCloud sync pattern is not trivial, but it follows a documented Apple pattern that the agent understood. The edge case (background sync) required human domain knowledge because it is not well-documented.

Case Study 5: Game Center Integration in Starfield Destroyer (Success)

The task: Add Game Center leaderboards and achievements to the space shooter.

What the agent did well:

  • Implemented GKLocalPlayer.local.authenticateHandler in the app entry point
  • Created a GameCenterManager with methods for score submission and achievement reporting
  • Added authentication state checking before all Game Center operations
  • Handled the offline case gracefully (game plays without Game Center, submits when reconnected)
  • Created achievement definitions matching the 8-ship progression system

What required manual work:

  • Creating the leaderboards and achievements in App Store Connect (web portal, not agent-accessible)
  • Configuring the Game Center entitlement in Xcode
  • Testing with a sandbox Game Center account (requires manual sign-in on device)

Project Lifecycle with Agents

Starting a New iOS Project

The optimal workflow for starting a new project with agent assistance:

Phase 1: Human Setup (15-30 minutes) 1. Create the Xcode project (File > New > Project) 2. Configure signing and capabilities 3. Set deployment target and supported destinations 4. Add any required entitlements (HealthKit, Game Center, etc.) 5. Create the initial CLAUDE.md with project identity and rules

Phase 2: Agent Implementation (hours to days) 1. Agent creates the data model (SwiftData, Core Data, or plain structs) 2. Agent builds views following your documented patterns 3. Agent implements business logic in manager/service classes 4. Agent writes unit tests 5. Build-test-fix loop via MCP (autonomous)

Phase 3: Human Integration (30-60 minutes) 1. Add agent-created files to Xcode targets 2. Verify signing and entitlements 3. Test on physical device 4. Review visual layout and UX 5. Submit to App Store Connect

Maintaining an Existing Project

For ongoing development on established apps:

You: Here's the next feature for Return: add a "Focus Score" that
     calculates from session duration and consistency. Show it on
     the main timer view. Build and test.

Claude: [reads CLAUDE.md, understands patterns]
        [reads TimerManager.swift, Settings.swift]
        [creates FocusScore.swift — model with calculation logic]
        [creates FocusScoreView.swift — display component]
        [integrates into ContentView.swift]
        [calls build_sim — 1 error: missing import]
        [fixes import]
        [calls build_sim — success]
        [writes FocusScoreTests.swift]
        [calls test_sim — all pass]

The agent’s effectiveness scales with how well your CLAUDE.md reflects the project’s current state. Update your CLAUDE.md when you add significant new features, change architectural patterns, or introduce new frameworks.

When to Involve the Agent vs. Not

Task Agent? Why
New SwiftUI view Yes Agents excel at declarative UI
SwiftData model changes Yes Well-defined, testable
Unit tests Yes Mechanical, pattern-based
Refactoring Yes Systematic, multi-file
Build error diagnosis Yes (via MCP) Structured feedback loop
New Xcode target Not by file edit I create targets in Xcode. Xcode 27.2’s MCP server lists XcodeNewTarget, which I have not used on a shipping app
Signing and provisioning No Portal-based, not agent-accessible
Visual polish No Requires human aesthetic judgment
Metal shader tuning No Requires device GPU testing
App Store submission No Portal and Xcode Organizer
Performance profiling Mostly no Requires Instruments; xctrace has text and Markdown output an agent can read (see Performance Optimization)
Accessibility audit Partial Agent can add labels, human verifies VoiceOver

Configuring Agent Definitions

If you use Claude Code’s agent definition system (.claude/agents/), create an iOS-specific agent:

---
name: ios-developer
description: iOS development agent with MCP build tools and SwiftUI expertise
tools: Read, Edit, Write, Grep, Glob, Bash, mcp__MobileBuildMCP__*, mcp__xcode__*
---

# iOS Developer Agent

You are an iOS development agent for apps targeting iOS 26+ with SwiftUI.

## Architecture Rules

- @Observable for all view models (NEVER ObservableObject)
- NavigationStack for all navigation (NEVER NavigationView)
- SwiftData for persistence
- Swift 6.2 strict concurrency
- @MainActor on all Observable classes

## Build & Test — Always Use MCP

Prefer MCP tools over raw shell commands for ALL build operations:

- **Build**: `build_sim` / `build_device` (NOT `xcodebuild` via Bash)
- **Test**: `test_sim` / `test_device` (NOT `xcodebuild test` via Bash)
- **Simulators**: `list_sims`, `boot_sim`, `open_sim`
- **Debug**: `debug_attach_sim`, `debug_stack`, `debug_variables`
- **Apple docs**: `DocumentationSearch` (NOT WebSearch for Apple APIs)
- **Swift verification**: `RunCodeSnippet` (NOT `swift` via Bash)

MCP returns structured JSON. Bash returns unstructured text.

## File Management Rules

- NEVER modify .pbxproj, .xcodeproj/, .xcworkspace/, .xib, .storyboard
- Create Swift files in the correct directory
- Report files that need manual addition to Xcode targets

## SwiftData Rules

- @Model classes are automatically Observable — do not add @Observable
- Use @Bindable for form bindings to model properties
- Use @Query in views, modelContext.fetch() elsewhere
- Document relationship delete rules

## When You Get Stuck

- Build errors: use `build_sim` via MCP for structured output
- API questions: use `DocumentationSearch` via Apple MCP
- Swift verification: use `RunCodeSnippet` via Apple MCP
- Never guess — verify with tools

The tools line is an allowlist: built-in tools by name, and mcp__<server>__* for every tool from one MCP server, using the names you registered the servers under. Invoke the agent by typing @ and picking it from the list, or by typing @agent-ios-developer.33


Testing Patterns for Agent-Assisted iOS

Agents write excellent unit tests when given clear guidance. Here are the patterns that produce the best results.

Test File Organization

# In CLAUDE.md:
## Test Structure

Tests mirror source structure:

- `ReturnTests/TimerManagerTests.swift` tests `TimerManager.swift`
- `ReturnTests/SettingsTests.swift` tests `Settings.swift`
- `ReturnTests/ConstantsTests.swift` tests `Constants.swift`

Test naming: `test_<what>_<condition>_<expected>`
Example: `test_start_whenStopped_transitionsToRunning`

Prompting for Tests

Effective test prompt:

Write unit tests for TimerManager covering:

1. Initial state is .stopped with timeRemaining == selectedDuration
2. start() transitions state to .running
3. pause() from .running transitions to .paused
4. reset() from any state returns to .stopped with original duration
5. start() from .paused resumes (state becomes .running)
6. Edge case: reset() when already stopped is a no-op
7. Edge case: pause() when already paused is a no-op

Follow the existing test pattern in SettingsTests.swift.
Use setUp() to create a fresh TimerManager for each test.

Why this works: Numbered acceptance criteria give the agent a checklist. Referencing an existing test file establishes the pattern. Specifying setUp() usage prevents the agent from creating tangled test state.

Ineffective test prompt:

Write tests for TimerManager.

This produces generic, shallow tests that miss edge cases and may not follow your project’s patterns.

Async Test Patterns

For testing timer-based and async code:

// Agent produces this pattern when guided correctly:
final class TimerManagerTests: XCTestCase {
    var sut: TimerManager!

    @MainActor
    override func setUp() {
        super.setUp()
        sut = TimerManager()
    }

    @MainActor
    func test_start_whenStopped_transitionsToRunning() {
        // Given
        XCTAssertEqual(sut.state, .stopped)

        // When
        sut.start()

        // Then
        XCTAssertEqual(sut.state, .running)
    }

    @MainActor
    func test_timerCountsDown_afterOneSecond() async throws {
        // Given
        sut.selectedDuration = 10
        sut.reset()
        sut.start()

        // When
        try await Task.sleep(for: .seconds(1.1))

        // Then
        XCTAssertLessThanOrEqual(sut.timeRemaining, 9.0)
    }
}

Key patterns agents need reminding about:

  • @MainActor on test methods that test @MainActor classes
  • async throws for tests that use Task.sleep or async operations
  • Tolerance in time-based assertions (1.1 seconds, not exactly 1.0)
  • Clean setUp() / tearDown() for test isolation

Snapshot Testing

For visual regression detection, consider adding swift-snapshot-testing:

Add snapshot tests for the main timer view in three states:
1. Stopped (showing full duration)
2. Running (showing countdown)
3. Completed (showing 00:00 with completion state)

Use SnapshotTesting library. Create reference images on first run.

Agents set up snapshot tests correctly but cannot review the reference images. You review the initial snapshots, then the agent’s tests catch visual regressions in future changes.


Context Window Management for iOS Projects

The 1M context window (Opus 5.5) is large but not infinite. iOS projects have specific context management considerations.

Token Cost of iOS Files

File Type Typical Size Approximate Tokens
SwiftUI view (simple) 50-100 lines 500-1,000
SwiftUI view (complex) 200-400 lines 2,000-4,000
SwiftData model 30-80 lines 300-800
Manager/service class 100-300 lines 1,000-3,000
Metal shader (.metal) 50-200 lines 500-2,000
Unit test file 50-200 lines 500-2,000
CLAUDE.md 100-300 lines 1,000-3,000
MCP response (build) varies 200-2,000
MCP response (test) varies 500-5,000

For a 50-file project: Reading all files consumes approximately 50,000-100,000 tokens — well within the 1M window. The agent can hold the entire project in context.

For a 100+ file project: The source alone may still fit (by the same estimate, 200 files is roughly 200,000-400,000 tokens), but build output, test results, and the conversation share the window, so selective reading is the better default. The agent reads CLAUDE.md first (for the file structure annotations), then reads specific files as needed. This is why file annotations in CLAUDE.md are critical — they guide the agent to the right files without reading everything.

Strategies for Large Projects

  1. Detailed CLAUDE.md file annotations — The agent reads the file map and navigates directly to relevant files
  2. Subagent delegation — Route exploration and research to subagents (clean context, returns summaries)
  3. Focused prompts — “Modify SettingsView.swift to add a new toggle” is better than “update the settings”
  4. Session boundaries — Start new sessions for unrelated features rather than extending a long session
  5. Use /compact — Claude Code’s compaction command summarizes the conversation and frees context

MCP Token Efficiency

One of the strongest arguments for MCP: structured JSON responses consume far fewer tokens than raw xcodebuild output.

Scenario Raw Bash Tokens MCP Tokens Savings
Successful build 3,000-10,000 200-500 85-95%
Failed build (1 error) 3,000-10,000 300-800 90-92%
Test results (20 tests) 2,000-5,000 500-1,000 75-80%
Simulator list 500-2,000 200-400 60-80%

Over a typical development session with 10-20 build cycles, MCP saves 30,000-150,000 tokens compared to raw xcodebuild — tokens that remain available for actual code reasoning.


Troubleshooting

“build_sim failed — scheme not found”

The agent is guessing the scheme name. Fix:

Use discover_projs and list_schemes to find the correct scheme name
for this project before building.

Or add the scheme name explicitly to your CLAUDE.md:

## Build
Primary scheme: `Return` (iOS)
Watch scheme: `ReturnWatch` (watchOS)
TV scheme: `ReturnTV` (tvOS)

“xcrun mcpbridge — command not found”

You need Xcode 26.3 or later (Xcode 27.2 is current). Check with xcodebuild -version. If you have Xcode 26.3+ but the command still fails:

# Ensure Xcode command line tools are selected
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

# Verify
xcrun mcpbridge --help

“MCP tools not appearing in Claude Code”

MCP tools registered mid-session may not appear until restart. Exit Claude Code and start a fresh session:

# Exit current session (Ctrl+C or /exit)
# Start fresh
claude

Then verify:

You: List all available MCP tools from MobileBuildMCP.

“Agent keeps using xcodebuild via Bash instead of MCP”

The agent is not discovering MCP tools via Tool Search. Two fixes:

  1. Add explicit guidance to CLAUDE.md (see Teaching the Agent to Use MCP)
  2. Prompt directly: “Use the build_sim MCP tool, not xcodebuild via Bash”

“Build succeeds but agent reports failure”

MobileBuildMCP parses xcodebuild output. If the build produces warnings that look like errors (common with deprecation warnings), the agent may misinterpret the result. Check the actual status field in the MCP response.

“Simulator hangs during boot”

Shut the hung simulator down and boot it again. If other work is running on the same Mac, target the one device instead of all:

xcrun simctl list devices available            # find the device's name or UDID
xcrun simctl shutdown "<device name or UDID>"   # or: xcrun simctl shutdown all
xcrun simctl boot "<device name or UDID>"

Xcode 27 added a one-step form, xcrun simctl reboot <device> (172303413).18

Or ask the agent:

Shut down the hung simulator, then boot it again.

“Agent tried to modify .pbxproj despite CLAUDE.md rules”

CLAUDE.md rules are suggestions. Hooks are enforcement. If you do not have the PreToolUse hook blocking .pbxproj writes, the agent will eventually attempt it. Install the hook:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); FP=$(echo \"$INPUT\" | jq -r \".tool_input.file_path // empty\"); if echo \"$FP\" | grep -qE \"\\.(pbxproj|xcworkspace|xib|storyboard)$|xcodeproj/|xcworkspace/\"; then echo \"BLOCKED: Do not modify Xcode project files. Create Swift files and add to Xcode manually.\" >&2; exit 2; fi'"
          }
        ]
      },
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'INPUT=$(cat); CMD=$(echo \"$INPUT\" | jq -r \".tool_input.command // empty\"); if echo \"$CMD\" | grep -qE \"\\.(pbxproj|xib|storyboard)|xcodeproj/|xcworkspace/\"; then echo \"BLOCKED: This command names an Xcode-managed file. Do not modify Xcode project files from the shell.\" >&2; exit 2; fi'"
          }
        ]
      }
    ]
  }
}

Rules say “please don’t.” A hook refuses the call, for the tools its matcher names. PreToolUse: Block .pbxproj Writes lists what this one does not cover.


FAQ

Which agent runtime should I start with?

Claude Code CLI with MobileBuildMCP (the server named XcodeBuildMCP until September 2026). It has the deepest MCP integration, the most mature hook system, and the 1M context window (Opus 5.5) that can hold entire iOS projects in working memory. Start here, then add Codex for review and Xcode native agents for quick inline edits as your workflow matures.

Do I need both MCP servers?

For most developers, MobileBuildMCP alone covers 90% of needs (builds, tests, simulators, debugging). Add Apple’s Xcode MCP if you want documentation search, Swift snippet verification, SwiftUI preview rendering, or, on Xcode 27, the String Catalog and project-setting tools. You can always add it later — the two servers are independent.

How do I set up MCP for iOS development with Claude Code?

Two commands. claude mcp add MobileBuildMCP -s user -e MOBILEBUILDMCP_SENTRY_DISABLED=true -- npx -y mobilebuildmcp@latest mcp adds MobileBuildMCP (82 tools for builds, tests, simulators, and debugging; it was named XcodeBuildMCP until September 23, 2026). claude mcp add --transport stdio xcode -s user -- xcrun mcpbridge adds Apple’s Xcode MCP server (54 tools on Xcode 27.2, 20 on Xcode 26.3). Apple’s server needs Xcode 26.3 or later and a running Xcode. Run claude mcp list to confirm both show as connected. Details are in MCP Setup.

Can AI agents modify Xcode project files (.pbxproj)?

Not by editing the file. The .pbxproj format cross-references every entry by UUID, and one bad edit can leave a project Xcode will not open. Block writes to .pbxproj, .xcodeproj/, .xcworkspace/, .xib, and .storyboard with a PreToolUse hook, let the agent create Swift files, and add them to targets yourself. Xcode 27.2 adds two Apple-provided alternatives: a JSON project format (.xcproj) that Apple describes as “easier for coding agents to edit,” and MCP tools that add targets, entitlements, Info.plist keys, and build settings through Xcode. I have not shipped with either yet.

What should I put in CLAUDE.md for an iOS project?

Six sections: project identity (bundle ID, target OS, architecture pattern), file structure with a purpose note on every file, build and test commands, key patterns and rules (for example, always @Observable, never ObservableObject), prohibitions (never touch .pbxproj), and framework-specific context (HealthKit permissions, SwiftData model relationships, SpriteKit scene hierarchy). For iOS 27 work, also name the new frameworks you use, because a model trained before June 2026 does not know them. Full examples are in CLAUDE.md Patterns.

What are AI agents good and bad at in iOS development?

Good: SwiftUI views, SwiftData models, unit tests, refactoring, and diagnosing build errors through MCP. Bad: hand-editing .pbxproj files, Interface Builder edits, performance optimization, code signing, Metal shader debugging, and judging whether a layout looks right. My subjective estimate is a 3-5x time-to-feature improvement on well-documented projects with MCP and hooks configured, and it is not a controlled measurement.

Can agents create a new Xcode project from scratch?

MobileBuildMCP includes scaffolding tools (scaffold_ios_project, scaffold_macos_project) that create new Xcode projects from templates, and on Xcode 27.2 Apple’s MCP server lists XcodeNewProject, which creates one from an Xcode template. However, for production apps, I recommend creating the project in Xcode (to get signing, capabilities, and target configuration correct) and then using agents for all code implementation. The 5 minutes you spend in Xcode’s new project wizard saves hours of agent-generated project configuration issues.

How do agents handle Swift Package Manager dependencies?

Well. Package.swift is a standard Swift file that agents can read and edit reliably. Adding dependencies, updating version ranges, and configuring targets all work. The limitation is .xcodeproj-based dependency management (Xcode’s package resolution UI) — that is Xcode-managed and should not be agent-edited.

Can agents submit to the App Store?

Not in this guide’s workflow. App Store submission involves signing, provisioning profiles, screenshots, metadata, and App Store Connect. Command-line routes exist for parts of it: xcodebuild -exportArchive can export or upload an archive, xcrun altool validates and uploads a build, and Apple publishes an App Store Connect API.39 None of them decides which build ships, which screenshots go up, or what the listing says, and a mistake there reaches a public page. The examples here stop at the archive: agents handle implementation, testing, bug fixing, and documentation, and the last mile of submission remains human-operated.

However, agents can help with App Store metadata. Ask the agent to write the app description, keywords, and what’s-new text based on the latest changes. This is text generation work where agents excel.

How do I handle secrets and API keys in agent-assisted iOS development?

Never commit secrets. For iOS apps that connect to backend APIs:

  1. Use .xcconfig files for environment-specific configuration
  2. Add .xcconfig files to .gitignore
  3. Reference config values via Info.plist build settings
  4. Document the required secrets in CLAUDE.md without including the actual values
## Configuration

API base URL and keys are in `Config.xcconfig` (not committed).
Required keys:

- `API_BASE_URL` — Backend server URL
- `API_KEY` — Authentication token

Create `Config.xcconfig` from `Config.xcconfig.template`.

The agent knows the keys exist and where they are used, but never sees the actual values.

What about SwiftUI animations — can agents write those?

Agents write animation code well syntactically but cannot verify the result visually. Simple animations (.animation(.spring()), .transition(.slide), withAnimation { }) produce correct results. Complex, multi-step animations with precise timing require visual iteration that agents cannot do.

Effective: “Add a spring animation when the timer transitions between states.”

Ineffective: “Make the timer animation feel satisfying.” (Subjective, requires visual tuning.)

How do agents handle error handling patterns?

Very well. Agents understand Swift’s do/catch, Result, and async throws patterns:

Implement error handling for the HealthKit authorization flow:
1. Check HKHealthStore.isHealthDataAvailable() — show alert if not
2. Request authorization — handle denial gracefully
3. On write failure — retry once, then show error
4. All errors should be user-facing with localized descriptions

Agents produce structured error handling with proper user-facing messages. They sometimes over-handle errors (catching exceptions that should propagate), so review the catch blocks.

Can I use agents for accessibility implementation?

Partially. Agents add accessibility labels, hints, and traits correctly:

Add accessibility labels to all interactive elements in TimerView:

- Timer display: current time remaining
- Start/Pause button: current state and action
- Reset button: "Reset timer"
- Duration picker: selected duration

What agents cannot do on their own: confirm on a device that VoiceOver navigation order is correct, that Dynamic Type scales well, or that contrast holds up. Xcode 27’s agent skills include three accessibility specialists (Dynamic Type, sufficient contrast, and VoiceOver) that audit view code against Apple’s accessibility nutrition labels. A code audit is a good first pass. It is not a VoiceOver session, so use Xcode’s Accessibility Inspector and a real device for verification.

How do agents handle Core Data migration (if not using SwiftData)?

Agents write Core Data migration mappings and model versions, but the manual Xcode steps (creating new model versions, selecting the current version) cannot be automated. If you are still on Core Data rather than SwiftData, document the model version history in CLAUDE.md:

## Core Data Model Versions

- V1: Initial (GroceryList, GroceryItem)
- V2: Added Category model (current)
- Migration: Lightweight automatic for V1→V2

How do agents handle SwiftUI previews?

Two ways: 1. Apple Xcode MCP’s RenderPreview tool builds a preview and returns a snapshot. The agent can verify that a preview compiles and renders without errors. On Xcode 27 it can also render variants, Preview groups, and other localizations, and on Xcode 27.2 pick the render destination. 2. Build-based verification via build_sim confirms that preview providers compile. If a preview crashes at runtime, the build still succeeds — the crash only manifests when Xcode attempts to render the preview.

RenderPreview needs Xcode running. Whether the preview looks right is still your call, not the agent’s.

What about visionOS and Apple Vision Pro?

The same patterns apply. MobileBuildMCP supports visionOS simulators, and the architectural patterns (@Observable, NavigationStack, SwiftData) are identical. RealityKit-specific code (3D content, immersive spaces, hand tracking) follows the same limitations as Metal — agents can write correct code but cannot verify spatial output.

How large can a project be before agents struggle?

At the sizes in this guide, the context window is not the limit. By the estimates in Context Window Management, a 50-file project is roughly 50,000-100,000 tokens of Opus 5.5’s 1M-token window, and the largest app in this guide’s portfolio is 63 files. On larger projects the agent uses file search and selective reading to work with subsets of the codebase, because build output, test results, and the conversation share the same window. Projects with 100+ files work fine: the agent reads files on demand.

The practical limit is not file count but codebase coherence. A well-documented 200-file project with a detailed CLAUDE.md produces better results than an undocumented 30-file project.

Do I need to know Swift to use agents for iOS development?

You need to be able to review agent output and make architectural decisions. You do not need to write every line yourself, but you need to understand Swift well enough to catch when the agent makes incorrect choices — especially around concurrency, memory management, and framework-specific patterns. An agent is a 10x amplifier of your existing skill, not a replacement for it.

How do agents handle merge conflicts in Swift files?

Agents resolve merge conflicts in Swift source files reliably. The standard conflict markers (<<<<<<<, =======, >>>>>>>) are well-understood by all agent runtimes. However, merge conflicts in .pbxproj files remain a manual resolution task — do not ask agents to resolve .pbxproj conflicts. Apple describes Xcode 27.2’s JSON project format (.xcproj) as merge-friendly; I have not yet resolved a conflict in one.

What is the cost of running agents for iOS development?

With Anthropic’s Max plan (Opus 5.5, 1M context), a typical iOS development session runs 30-120 minutes and processes 200K-800K tokens. MCP tool calls add minimal overhead (structured JSON responses are token-efficient compared to raw build output). The cost is comparable to running Claude Code for any other codebase — iOS development is not meaningfully more or less expensive than web development.

Can I use agents with UIKit projects?

Yes, but agents are more effective with SwiftUI. UIKit requires more boilerplate, has less declarative structure, and often involves Interface Builder files that agents cannot edit. If you have a UIKit project, consider using agents for the model layer and business logic while handling UI manually, or incrementally migrating views to SwiftUI.

How do agents handle localization?

Agents create and edit .xcstrings (Xcode string catalog) files effectively. They can add new localization keys, provide translations, and maintain consistency across languages. The structured JSON format of .xcstrings files is agent-friendly. For .strings files (legacy format), agents also perform well — the key-value format is straightforward. Xcode 27 adds a tool-based route: its MCP server has tools that read, plan, and edit String Catalog translations, and Xcode’s agents can translate anything from one feature to a whole project. The Xcode 27.3 beta extends those tools to adding and removing strings and changing their state.


Common Agent Mistakes in iOS (and How to Prevent Them)

These are the recurring errors I have observed across thousands of agent interactions on 8 iOS projects. Each one has a prevention strategy.

Mistake 1: Mixing Observable Patterns

What happens: The agent uses @Observable in one file and ObservableObject in another, or adds @Observable to a @Model class (which is already Observable).

Prevention: Explicit rules in CLAUDE.md:

- NEVER use ObservableObject — use @Observable
- NEVER add @Observable to @Model classes (already Observable)
- NEVER use @StateObject — use @State with @Observable
- NEVER use @ObservedObject — access @Observable properties directly

Mistake 2: Creating Retain Cycles in Closures

What happens: The agent creates closures that capture self strongly, especially in Timer.publish, NotificationCenter, and completion handlers.

Prevention: Include a closure pattern in CLAUDE.md:

## Closure Pattern

- Timer callbacks: use `[weak self]` and guard
- NotificationCenter observers: store in `Set<AnyCancellable>` and use `[weak self]`
- Completion handlers: use `[weak self]` for any closure stored beyond the call site

Mistake 3: Ignoring @MainActor Requirements

What happens: The agent creates @Observable classes without @MainActor isolation, causing Swift 6.2 concurrency warnings or runtime crashes when UI updates happen off the main thread.

Prevention:

## Concurrency Rule
ALL @Observable classes MUST be @MainActor:
```swift
@Observable
@MainActor
final class SomeManager { }
```

What happens: The agent uses the deprecated NavigationLink(destination:label:) instead of the type-safe NavigationLink(value:) + .navigationDestination(for:) pattern.

Prevention:

## Navigation Pattern
ALWAYS use value-based navigation:
```swift
NavigationLink(value: item) { ItemRow(item: item) }
.navigationDestination(for: Item.self) { ItemDetailView(item: $0) }
```
NEVER use: `NavigationLink(destination: ItemDetailView(item: item)) { }`

Mistake 5: Hardcoding Simulator Names

What happens: The agent writes build commands with specific simulator names (“iPhone 16 Pro”) that may not exist on your system.

Prevention: MCP handles this — list_sims discovers available simulators. In CLAUDE.md:

## Simulators
Do NOT hardcode simulator names. Use `list_sims` MCP tool to discover
available devices, then `boot_sim` with the discovered device ID.

Mistake 6: Creating Files in Wrong Directories

What happens: The agent creates a new view file in the project root instead of the Views/ subdirectory, or puts a model in the wrong group.

Prevention: The file structure annotations in CLAUDE.md guide placement. Additionally:

## File Placement Rules

- Views → `AppName/Views/`
- Models → `AppName/Models/`
- Managers → `AppName/Managers/`
- Extensions → `AppName/Extensions/`
- Tests → `AppNameTests/`

Mistake 7: Not Handling Platform Availability

What happens: The agent uses HealthKit in shared code that compiles for tvOS (where HealthKit is unavailable), or uses ActivityKit in watchOS code.

Prevention:

## Platform Guards

- HealthKit: `#if canImport(HealthKit)` (unavailable on tvOS)
- ActivityKit: `#if canImport(ActivityKit)` (iOS only)
- WatchKit: `#if os(watchOS)`
- UIKit haptics: `#if os(iOS)` (unavailable on tvOS, watchOS uses WKHaptic)

Mistake 8: Over-Engineering Simple Features

What happens: The agent creates a protocol, a protocol extension, a concrete implementation, a factory, and a dependency injection container for what should be a 20-line utility function.

Prevention: Include a simplicity principle:

## Architecture Principle
Prefer the simplest solution that handles the requirements.

- Direct implementation over protocol abstraction (unless you have 2+ conforming types)
- Concrete types over generics (unless reuse is proven)
- Extensions on existing types over new wrapper types

The Honest Assessment

After shipping 8 iOS apps with AI agents, here is the summary:

Agents transformed: Implementation speed. What took days takes hours. SwiftUI views, SwiftData models, unit tests, refactoring — these are now primarily agent-produced and human-reviewed.

Agents did not transform: Architectural decisions, visual design, performance optimization, or App Store submission. These remain human-driven.

The multiplier is real but bounded. My subjective estimate across the 8-app portfolio: 3-5x time-to-feature improvement on well-documented projects with proper MCP and hook configuration. This is not measured against a control group; it is wall-clock comparison between agent-assisted features and equivalent solo work in the same codebases. Undocumented projects with no hooks see maybe 1.5-2x improvement — the agent spends too much time guessing instead of building.47

The investment that pays off: Time spent on CLAUDE.md, hooks, and MCP configuration. Every hour of setup saves many hours of correcting agent mistakes. The configuration is the product — the agent is the execution engine.

What surprised me: How much the MCP servers changed the dynamic. Before MCP, agents were sophisticated text editors that happened to understand Swift. After MCP, they are development partners that write, build, test, debug, and iterate. The structured feedback loop is the difference between an agent that writes code and one that ships code.

What I would tell past-me: Start with the smallest app (Reps, 14 files), get the MCP and hook setup right, write a thorough CLAUDE.md, and then scale the patterns to larger projects. Do not start with the 63-file multi-platform app. The infrastructure investment is the same regardless of project size — do it once on a small project, then copy to everything else.

Where the toolchain stands: Xcode 26.3’s native agent integration was the beginning. Xcode 27 turned it into a platform with plug-ins, MCP servers, and simulator control, and Xcode 27.2 added a project format written with agents in mind. Apple now ships MCP support in Xcode itself. The setup this guide describes (a clean CLAUDE.md, a testable architecture, automated hooks) is the same on every one of those releases.


Quick Reference Card

Installation (One-Time Setup)

# MobileBuildMCP (82 tools; named XcodeBuildMCP before September 2026)
claude mcp add MobileBuildMCP -s user \
  -e MOBILEBUILDMCP_SENTRY_DISABLED=true \
  -- npx -y mobilebuildmcp@latest mcp

# Apple Xcode MCP (54 tools on Xcode 27.2)
claude mcp add --transport stdio xcode -s user -- xcrun mcpbridge

# Codex MCP setup
codex mcp add MobileBuildMCP -- npx -y mobilebuildmcp@latest mcp
codex mcp add xcode -- xcrun mcpbridge

# Verify
claude mcp list

Essential CLAUDE.md Sections

1. Project identity (bundle ID, target OS, architecture)
2. File structure with annotations
3. Build and test commands
4. Key patterns and rules
5. Prohibitions (NEVER touch .pbxproj)
6. Framework-specific context

Essential Hooks

{
  "hooks": {
    "PreToolUse": [
      { "matcher": "Edit|Write", "hooks": [{ "type": "command", "command": "<block .pbxproj>" }] },
      { "matcher": "Bash", "hooks": [{ "type": "command", "command": "<block shell commands naming .pbxproj>" }] }
    ],
    "PostToolUse": [{ "matcher": "Edit|Write", "hooks": [{ "type": "command", "command": "<swiftformat>" }] }]
  }
}

Architecture Rules

@Observable         (not ObservableObject)
NavigationStack     (not NavigationView)
@State              (not @StateObject)
SwiftData @Model    (not Core Data)
async/await         (not completion handlers)
@MainActor          (on all Observable classes)
.glassEffect()      (Liquid Glass, iOS 26+)

MCP Tool Priorities

Build:     build_sim          (not xcodebuild via Bash)
Test:      test_sim           (not xcodebuild test via Bash)
Sim:       list_sims/boot_sim (not xcrun simctl via Bash)
Docs:      DocumentationSearch (not WebSearch)
Snippets:  RunCodeSnippet     (not swift via Bash; ExecuteSnippet on Xcode 26)

Changelog

Date Changes Source
2026-11-25 The guide now describes the shipped toolchain. iOS 27 and Xcode 27 shipped September 14, 2026; Xcode 27.2 (27B52) is current and needs an Apple silicon Mac on macOS Tahoe 26.6 or later (the guide said 26.4). XcodeBuildMCP became MobileBuildMCP in v2.7.1 (September 23): every command, config example, and environment variable here uses the new name, with a migration subsection. The Apple MCP section lists the 54 tools on Xcode 27.2. New: Xcode 27.2’s JSON project format (.xcproj), the 27.3 betas (GitHub Copilot, String Catalog tools, xctrace helpers), Siri AI’s developer preview, and Apple’s Mac permission changes. Corrections: hook examples now use the settings shape Claude Code accepts; the agent definition’s tools line; init installs a skill, not MCP config; Opus 5.5 and the GPT-6.2 lineup replace older model names; four FAQ entries added. Corrected the same day: a claude -p run does not need --dangerously-skip-permissions, and the batch example now pre-approves its tools; the SwiftLint hook passes the file positionally (--path was removed in SwiftLint 0.56.0), and it and the auto-build hook now return their output to the agent; the .pbxproj hook states what it covers and gains a Bash matcher; tokenCount(for:) needs iOS 26.4; Codex hooks are stable since v0.124.0; Evaluations is not macOS-only; simulator names in commands are placeholders; the SwiftLint hook honors the configuration’s excluded list; the batch section names the shell commands acceptEdits also approves and gives a dontAsk grant; the Xcode setup step and the cost row describe account sign-in. 26 27 28 29 30 31 32 33 34 35 36 37 38 39
2026-11-11 Apple’s xcode plugin in the official Claude Code marketplace; the hidden Xcode hang. The Claude Code CLI section gains the plugin (claude plugin install xcode@claude-plugins-official). Its marketplace entry arrived on November 6, 2026 (UTC) with a command source that Claude Code displays and asks you to accept. On Xcode 27.2 the plugin directory holds 16 Apple-written skills and an .mcp.json for xcrun mcpbridge; I did not complete the install. The Apple Xcode MCP section gains an operator warning: xcrun agent skills export and a session’s MCP tool call each waited with no timeout on a hidden Xcode, and the one I sampled was sitting at its first-launch screen. Beyond pgrep and kill, I have not confirmed the remedy. I measured on November 10, 2026, on one Mac with the headless MCP preview on, Xcode 27.2 (27B52), and Claude Code 2.1.322. Added the same day: the Apple Xcode MCP section and the TL;DR label the 20-tool count as Xcode 26.3’s and give the 54 tools the bridge listed on Xcode 27.2, and the plugin paragraphs point to a companion post on what a session shows. The rest of the guide still describes the Xcode 27 betas as of August 16. 48 49
2026-08-16 Codex model correction, and Xcode 27’s agent platform folded in. Correction (reader-facing error): the Codex CLI section and the dual-review matrix claimed Codex “uses OpenAI models (GPT-4o, o3).” Neither is a Codex model. The lineup is GPT-5.6 Sol / Terra / Luna plus GPT-5.3 Codex Spark (text-only research preview), and GPT-5.4 / GPT-5.4-mini retire from Codex on 2026-08-31.23 Xcode 27 beta 5 (27A5237l, Aug 10) supersedes beta 4 throughout, and two beta-5 items are body-worthy: agents can verify watchOS apps including Digital Crown, side, and Action button input (181147968), and sudo xcrun mcp-server enable previews an MCP server “that runs without requiring an open Xcode workspace” — with --unsafe-always-allow-all-agents for unattended runs, which Apple and this guide both advise against at a desk (181836944). Larger correction the July 29 pass missed: the “Xcode 26.3 Native Agents” section described an inline assistant that Xcode 27 replaced back in beta 1 (June 8). Agents now take plug-ins carrying skills, MCP servers, and ACP configs (178289210), boot simulators and synthesize touches (175179787), manipulate run state and modify build settings, entitlements, and Info.plist keys (176935844), and run under a filesystem-access security layer (178289431). Section retitled, limitation list scoped to 26.x with a 27 correction, matrix re-cut per version, and an operator warning added: the PreToolUse .pbxproj hook has no jurisdiction inside Xcode. Also recorded: LLDB ships its own MCP server, lldb-mcp, since beta 2 (176901842), so the “two servers” framing is now three. Platform: iOS/iPadOS 26.6.1 (23G82) and macOS 26.6.2 (25G82) shipped Aug 10. Verified unchanged: XcodeBuildMCP 2.7.0, and the Xcode 26 / iOS 26 SDK upload mandate. 22 23
2026-07-29 Platform watch closed: iOS, iPadOS, and macOS 26.6 shipped stable July 27. The open item carried across the last three rows is resolved. iOS 26.6 and iPadOS 26.6 both shipped as build 23G71 and macOS 26.6 as 25G72, alongside tvOS 26.6 (23L773), visionOS 26.6 (23O770), and watchOS 26.6 (23U67). Worth noting for anyone who tested against the RC: 23G71 is the same build number Apple seeded as the iOS 26.6 RC on July 20, so the RC promoted to stable unchanged — an RC-validated agent setup needs no re-verification. Xcode 27 beta 4 (27A5228h, July 20) remains the newest Xcode beta and XcodeBuildMCP remains 2.7.0 (published July 23), both unchanged since the last pass. Prior changelog rows are left as written; they record what was known at the time. 24
2026-07-28 Rendering fix: ten orphaned citations reattached, changelog Source column restored. Footnotes 2-11 - the guide’s original citation set - lost their in-text markers as later update loops layered footnotes 12-22 on top, leaving ten reference-list entries whose back-arrows pointed at #fnref:N anchors that no longer existed in the page. Each is now attached to the claim it actually supports: the MCP specification to the protocol definition, the XcodeBuildMCP repository and official site to the tool-inventory and CLI-command counts, Apple’s Xcode 26.3 MCP server and Rudrank Riyam’s independent confirmation to the xcrun mcpbridge and XPC paragraphs, Swiftjective-C to the native Claude Agent and Codex providers, the Claude Code documentation to the runtime description, SWE-bench to the structured-tools-over-shell argument, and SwiftFormat to the format-on-save hook. Separately, this changelog’s header declared two columns while every row carried three, so python-markdown truncated each row to the header width and silently dropped its Source cell; the header is now three columns. Live citations on the rendered page: 12 -> 22. -
2026-07-25 Claude Opus 5 is the default Opus model; Claude Code MCP diagnostics. Claude Code v2.1.219 (July 24) made Claude Opus 5 (claude-opus-5) the default Opus model — 1M context, $5/$25 per MTok base (unchanged from Opus 4.8), fast mode at $10/$50, May 2026 knowledge cutoff, effort defaulting to high; Opus 4.7 was dropped from fast mode, so /fast now means Opus 5 or Opus 4.8. The guide’s six body references attributing its 1M context window to Opus 4.6 now say Opus 5 (runtime comparison, comparison table, context-management section, runtime recommendation, and the two FAQ answers on working-memory capacity and session cost). The 1M figure and the ~50-file working-memory estimate are unchanged — this is a model-name currency fix, not a capability revision. Same release added MCP connection diagnostics: claude mcp list and /mcp now report HTTP status and error text when a server fails to connect, a warning fires for MCP config values carrying hidden leading or trailing whitespace, and the headless stream-json init event gained mcp_server_errors listing --mcp-config entries skipped by validation. Worth knowing, but the Verification section stays as written: the HTTP-status half only applies to remote servers, and both servers this guide installs (npx xcodebuildmcp, xcrun mcpbridge) are stdio — the whitespace warning and mcp_server_errors are the parts that can bite an iOS setup, typically a stray space copied into a config path. v2.1.219 also added sandbox.network.strictAllowlist, which denies non-allowlisted hosts for sandboxed commands without prompting; it sits alongside the sandbox.allowAppleEvents entry footnote 20 already tracks. It is opt-in and untested here against a real build, but the plausible iOS gotcha is a sandboxed SPM resolve or xcodebuild -resolvePackageDependencies reaching github.com — allowlist your package hosts before enabling it. v2.1.220 (July 25) is “Bug fixes and reliability improvements” only. Platform watch: unchanged and still open — iOS 26.6 and macOS 26.6 stable have not shipped (RCs seeded July 20; press targets ~July 27). 2025
2026-07-24 XcodeBuildMCP 2.7.0. npm latest moved 2.6.2 → 2.7.0 (published 2026-07-23). Headline: UI automation tools now work fully with Xcode 27 simulators through Device Hub — simulator window launching and keyboard controls included — so agent-driven UI verification on the iOS 27 beta no longer requires falling back to Xcode 26 simulators; the iOS 27 section and the XcodeBuildMCP section now say so. Breaking: build/test tools return schemaVersion: 3 structured results (v2 since 2.6.0) — validators pinned to 2 need updating. Behavior change: with configuration omitted, build/test/clean/app-path tools now honor the scheme action’s configuration instead of always using Debug — the Build & Test section adds the operator guidance (pass configuration explicitly or use session_set_defaults where Debug artifacts are assumed). Also: reusable .xctestproducts test-preparation packages (re-run tests without rebuilds, fresh .xcresult each run), session-default extraArgs, a new xcodebuildmcp purge workspace-storage command, and a fix for MCP clients waiting 10-17s for tool availability (false-failed health checks). Housekeeping: the canonical repo home is github.com/getsentry/XcodeBuildMCP — npm’s repository field points there and the old cameroncooke URL 301-redirects — so the remaining old-URL citation was updated; tool inventory verified unchanged at 2.7.0 (docs still advertise 82 across 12 workflows; a like-for-like stdio tools/list against 2.6.2 and 2.7.0 returned identical inventories, CLI still 100 commands / 72 canonical). Platform watch: still open from the last row — iOS 26.6 RC (23G71) landed July 20 and the iOS/macOS 26.6 stable release is expected imminently (~July 27). 1921
2026-07-21 Xcode 26.6 stable + Xcode 27 correction, XcodeBuildMCP 2.6.x, Claude Code auto-backgrounding. Xcode 26.6 shipped stable 2026-06-25 (build 17F113; RC June 8, RC 2 June 18) with three agent-relevant Coding Intelligence changes: Google Gemini as a coding-assistant provider (171990272), Agent Client Protocol support (178294840) so any ACP-compatible agent can plug into the Intelligence panel, and Preview Snapshot MCP variant rendering — light/dark, orientation, type sizes (178831772); it ships Swift 6.3 + iOS 26.5-generation SDKs, requires macOS Tahoe 26.2+, and fixes two agent-turn crashes plus the hang when an agent asks a question. Prerequisites now recommend 26.6+. Correction: the 2026-06-08 row below states Apple had not published a verified “Xcode 27” version — that was wrong when written: Xcode 27 beta (27A5194q) was on Apple’s releases page WWDC day one, and is now on beta 4 (27A5228h, 2026-07-20) with Swift 6.4 + iOS 27 SDKs on macOS Tahoe 26.4+; the iOS 27 section now covers it (Coding Intelligence plan mode via known issue 178673449, RenderPreview groups + localization previews, “Prepare Project for Localization” removed-key reporting, ASan-on-27.0 needs Xcode 26.5+). XcodeBuildMCP moved 2.5.2 → 2.6.2 (npm latest, June 2): the v2.6.0 “runtime UI automation” release adds stable element refs + screen hashes to snapshot_ui (sinceScreenHash skip), new wait_for_ui / batch / drag tools, type_text replaceExisting, nextSteps in v2-schema results, and opt-in XCODEBUILDMCP_HEADLESS_LAUNCH; tool counts corrected from “59 across 8 categories” to 82 MCP tools across 12 workflow categories (CLI: 100 commands, 72 canonical), including the new xcode-ide proxy that calls Xcode-IDE-only MCP tools through XcodeBuildMCP. Claude Code v2.1.212 (July 16) auto-backgrounds MCP calls running >2 min (CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS tunes/disables) — xcodebuild builds and tests routinely cross that line — and v2.1.206 (July 9) fixed per-server request_timeout_ms being ignored (60s-default timeouts on long calls in fresh sessions); v2.1.181 (June 17) added sandbox.allowAppleEvents and fixed macOS error -600 for open/osascript in sandboxed sessions, un-breaking open -a Simulator workflows. Platform watch: iOS 26.6 RC (23G71) and iOS 27 beta 4 both landed July 20 — iOS 26.6 stable is imminent; the App Store age-rating questionnaire added social-media questions July 9, with answers required from September 2026 for new submissions and updates. 17181920
2026-06-08 WWDC 2026 / iOS 27 beta. Added the “iOS 27 and WWDC 2026: What Your Agent Now Builds With” section and a TL;DR note. iOS 27 is in beta as of the June 8 keynote; iOS 26 remains the shipping release, so the section frames the new frameworks as what to target against the iOS 27 beta SDK while the agent-development workflow (runtimes, MCP, CLAUDE.md, hooks) is unchanged. Agent-relevant additions, each cross-linked to a verified deep-dive: Foundation Models GenerationOptions.ToolCallingMode + built-in Vision tools (OCRTool/BarcodeReaderTool); App Intents LongRunningIntent/performBackgroundTask, SyncableEntity, IndexedEntityQuery; the new Core AI framework (run your own models on Apple Silicon); the new Evaluations framework (XCTest for model quality); plus SwiftData observation/history, HealthKit workout zones, and SwiftUI iOS 27. Xcode version guidance unchanged — Apple has not published a verified “Xcode 27” version, so the guide keeps its Xcode 26.5-stable recommendation; the operator note is to name these frameworks in the agent’s context because pre-June-2026 models default to the iOS 26 shape. 1213141516
2026-05-28 Beta channel + WWDC26 framing. Apple Developer (May 26) announced beta releases of iOS 26.6, iPadOS 26.6, macOS 26.6, tvOS 26.6, visionOS 26.6, and watchOS 26.6 alongside an Xcode 26.6 beta; the call to action specifically says to build and test with Xcode 26.5 against the new beta SDKs, so agent workflows should keep xcode-select pinned to stable Xcode 26.5 (build 17F42) while installing the beta SDKs side-by-side for forward-compatibility testing rather than switching DEVELOPER_DIR to the beta. WWDC26 (May 18 announcement) is scheduled for June 8-12, 2026 — the next likely inflection for Swift, SwiftUI, App Intents, Foundation Models, and on-device agent APIs. Coding Intelligence and Foundation Models guidance in this guide remains targeted at Xcode 26.5 stable; the beta-channel SDKs are not yet a recommended substrate for production agent workflows. Apple Developer (May 21) also announced age-rating changes for Australia and Vietnam effective June 18, 2026 — non-agent guidance but worth flagging for portfolio compliance. 41
2026-05-24 Corrected the Xcode 26.5 stable release date to 2026-05-11 and pinned the build as 17F42 from Apple’s releases page. Local verification this pass: xcodebuild -version returned Xcode 26.5 / Build version 17F42; npm latest for xcodebuildmcp returned 2.5.2 with time.modified 2026-05-12T07:40:41.737Z.41
2026-05-16 Bumped recommended Xcode to 26.5+ (released 2026-05-11). Two new Coding Intelligence features matter for agent workflows: messages can now be queued in the coding assistant so you don’t wait for a response before lining up the next request, and agents can ask clarifying questions before proceeding — both reduce the friction of running Xcode’s native agents in parallel with Claude Code or Codex sessions.41 XcodeBuildMCP currentness check: v2.5.2 (2026-05-12) is the latest, adding bundled AXe 1.7.0 and a fix for a log-capture filter-validation issue; the xcodebuildmcp init flow from v2.1.0+ remains the recommended install path.
2026-04-28 Bumped recommended Xcode to 26.4+ for agent workflows (26.4.1, 2026-04-16, build 17E202 is the latest stable, bug-fix only). Cited Xcode 26.4 features (2026-03-24, build 17E192) useful for agent-written tests and localization: Swift Testing image attachments, severity on Issue.record, UI-test crash warnings with attached crashlogs (specifically for XCUIApplication(bundleIdentifier:) / XCUIApplication(url:) apps), String Catalog editor improvements. Added xcodebuildmcp init auto-installer (v2.1.0+, 2026-02-23) as alternative to manual MCP setup.
2026-04-27 App Store Connect: Xcode 26+ submissions mandatory starting 2026-04-28. Foundation Models gained SystemLanguageModel.contextSize and tokenCount(for:) APIs (back-deployed to iOS 26.4) — added a pattern for agent-generated FM prompt-budget code. iOS 26.4.2 (Apr 22) and iOS 26.5 beta 3 (Apr 20) shipped without changes that affect the agent toolchain.
2026-04-13 Initial publication. 8 apps, 3 runtimes, MCP setup, CLAUDE.md patterns, hooks, case studies.

References


  1. MobileBuildMCP, Privacy & Telemetry, read November 25, 2026: “MobileBuildMCP uses Sentry for internal error monitoring,” limited by default to the server’s own runtime failures; “user home paths become /Users/<redacted>/...”; tool inputs and outputs, project build and test failures, and environment variables are listed under what is never sent. Setting MOBILEBUILDMCP_SENTRY_DISABLED=true (or sentryDisabled: true in the project config) “fully disables the SDK.” Earlier versions of this footnote described the wider pre-v2.1.0 scope. ↩

  2. Anthropic, “Model Context Protocol Specification,” modelcontextprotocol.io/specification. The MCP specification defines the JSON-RPC transport, tool discovery, and resource protocol that both MobileBuildMCP and Apple’s Xcode MCP implement. ↩

  3. MobileBuildMCP (XcodeBuildMCP before v2.7.1), github.com/getsentry/MobileBuildMCP. Open source, maintained by Sentry. 82 tools as of v2.7.1, spanning simulator, device, macOS, debugging, UI automation, coverage, and Swift packages. Requirements in the README: macOS 14.5 or later, Xcode 16.x or later, Node.js 18.x or later (not required for the Homebrew install). ↩

  4. Apple introduced the Xcode MCP server as part of the Xcode 26.3 intelligent developer tools initiative, positioning MCP as the interface layer between AI coding assistants and the Xcode toolchain. See Xcode Release Notes for official documentation. ↩

  5. Rudrank Riyam, “Exploring Xcode Using MCP Tools,” rudrank.com/exploring-xcode-using-mcp-tools-cursor-external-clients, 2026. Independent confirmation of Apple’s MCP tool count, XPC dependency, and documentation search capabilities. ↩

  6. Jimenez, C.E., Yang, J., Wettig, A., et al., “SWE-bench: Can Language Models Resolve Real-World GitHub Issues?” ICLR 2024. arxiv.org/abs/2310.06770. Agents with structured tool access significantly outperformed agents limited to unstructured shell commands. The finding validates structured MCP interfaces for agent effectiveness. ↩

  7. Claude Code CLI documentation, code.claude.com. Hook system, MCP configuration, subagent delegation, and agent definitions. ↩

  8. SwiftFormat, github.com/nicklockwood/SwiftFormat. The Swift formatting tool used in PostToolUse hooks for consistent code style. ↩

  9. MobileBuildMCP official site, mobilebuildmcp.com, read November 25, 2026 (xcodebuildmcp.com now redirects there). The tools reference reads “All 82 tools MobileBuildMCP advertises, grouped by workflow,” generated live from v2.7.1, and the workflows page states: “By default only the simulator workflow is enabled.” ↩

  10. Swiftjective-C, “Agentic Coding in Xcode 26.3 with Claude Code and Codex,” swiftjectivec.com, by Jordan Morgan, February 4, 2026: “Xcode 26.3 dropped with support for agentic coding.” First impressions of Codex and Claude inside Xcode 26.3, with the xcrun mcpbridge commands for adding Apple’s MCP server to Claude Code and Codex. The post states no tool count. ↩

  11. Blake Crosley, “Two MCP Servers Made Claude Code an iOS Build System,” blakecrosley.com/blog/xcode-mcp-claude-code, February 2026. Setup walkthrough and real-world results from the same author’s iOS development workflow. ↩

  12. Foundation Models in iOS 27: Tool-Calling Control, sourced from Apple’s iOS 27 beta documentation for Foundation Models (GenerationOptions.ToolCallingMode, OCRTool, BarcodeReaderTool). WWDC 2026; verified June 8, 2026. GenerationOptions.ToolCallingMode, OCRTool, and BarcodeReaderTool are present in the iOS 27.2 SDK that ships with Xcode 27.2 (27B52), checked November 25, 2026. ↩↩↩

  13. App Intents in iOS 27: Background, Sync, Spotlight, sourced from Apple’s iOS 27 beta documentation for App Intents (LongRunningIntent, performBackgroundTask(options:operation:), SyncableEntity, IndexedEntityQuery). WWDC 2026; verified June 8, 2026. The four symbols are declared in the AppIntents interface of the iOS 27.2 SDK in Xcode 27.2 (27B52), checked November 25, 2026. ↩↩↩

  14. Core AI: Running Models on Apple Silicon, covering the new iOS 27 / macOS 27 Core AI framework for running your own models on Apple Silicon. Apple’s Core AI documentation (“Run AI models in your app on Apple silicon.”) lists iOS, iPadOS, Mac Catalyst, macOS, tvOS, visionOS, and watchOS 27.0; read from the DocC JSON on November 25, 2026. WWDC 2026; post verified June 8, 2026. CoreAI.framework is in the iOS 27.2 and macOS 27.2 SDKs in Xcode 27.2 (27B52), checked November 25, 2026. ↩↩↩

  15. Evaluations: XCTest for Model Quality, covering the new Evaluations framework for measuring model-output quality in a test suite. Apple’s Evaluations documentation (“Measure the quality of your app’s intelligence-powered features.”) lists iOS 27.0, iPadOS 27.0, Mac Catalyst 27.0, macOS 27.0, visionOS 27.0, watchOS 27.0, and Xcode 27.0; read from the DocC JSON on November 25, 2026. WWDC 2026; post verified June 8, 2026. Evaluations.framework ships in Xcode 27.2 (27B52) among the iPhoneOS and macOS platform developer frameworks, beside the testing frameworks, checked November 25, 2026. ↩↩↩

  16. SwiftData in iOS 27: Observation and History, HealthKit in iOS 27: Workout Zones, New Types, and What’s New in SwiftUI for iOS 27, each sourced from Apple’s iOS 27 beta documentation. WWDC 2026; verified June 8, 2026. Apple’s framework documentation: SwiftData, HealthKit, and SwiftUI. The iOS 27 items in that bullet rest on the three posts; they were not re-checked against Apple’s pages on November 25, 2026. ↩↩

  17. Apple, “Xcode 26.6 Release Notes” and Apple Developer Releases. Xcode 26.6 (build 17F113) listed 2026-06-25; RC (17F109) 2026-06-08, RC 2 (17F113) 2026-06-18. Cited from the release notes: “Google Gemini is now available in the coding assistant” (171990272); “Xcode adds support for the Agent Client protocol” (178294840); “The Preview Snapshot MCP tool can now render variants such as light/dark appearance, portrait/landscape orientation, and various type size overrides” (178831772); fixed a crash when closing a window during an active agent turn (174186260), a crash during agent file operations involving non-absolute paths (174752919), and “a bug that could cause Xcode to hang indefinitely when an agent asked the user a question” (177989242). Xcode 26.6 includes Swift 6.3 and SDKs for iOS 26.5, iPadOS 26.5, tvOS 26.5, watchOS 26.5, macOS 26.5, and visionOS 26.5; requires macOS Tahoe 26.2 or later. Release-notes text verified 2026-07-21. ↩↩↩↩↩↩↩

  18. Apple, “Xcode 27 Release Notes”, read from the DocC JSON on November 25, 2026. “Xcode 27 includes Swift 6.4 and SDKs for iOS 27, iPadOS 27, tvOS 27, watchOS 27, macOS 27, and visionOS 27” and “requires a Mac running macOS Tahoe 26.6 or later”; “Xcode 27 will only install and run on Apple silicon Macs” (162138432). Cited items: first-class planning (172857081) and the plan-mode confirmation bar issue, now under Resolved Issues (178673449); RenderPreview Preview groups (174692209), localization previews (181040291), and display name and line number (182215198); String Catalog MCP tools (176376425); “Prepare Project for Localization” removed keys (179755385); Google Antigravity (183074664); tvOS verification (183317784); simctl and devicectl reboot (172303413); Address Sanitizer on 27.0 with Xcode 26.4 or older (178072780). The first beta (27A5194q) was listed on Apple’s releases page on 2026-06-08, recorded here on 2026-07-21. ↩↩↩↩↩↩↩↩↩↩↩↩↩

  19. XcodeBuildMCP v2.6.0 release, 2026-06-01 (“runtime UI automation”); v2.6.1 and v2.6.2 followed, and v2.6.2 is npm latest (verified 2026-07-21: npm view xcodebuildmcp dist-tags.latest → 2.6.2, published 2026-06-02). Tool count from the official docs (xcodebuildmcp.com/docs/tools: “All 82 tools XcodeBuildMCP advertises, grouped by workflow”), cross-checked locally against v2.6.2 on 2026-07-21: xcodebuildmcp tools reports 100 CLI commands (72 canonical) across 12 workflow categories (coverage, debugging, device, macos, project-discovery, project-scaffolding, simulator, simulator-management, swift-package, ui-automation, utilities, xcode-ide), and a stdio tools/list with all 12 workflows enabled returned the tool names used in this guide’s inventory table, including wait_for_ui, batch, drag, xcode_ide_list_tools, and xcode_ide_call_tool. The ~70% wall-clock / ~68% token / ~76% tool-call reduction figures are the project’s own benchmark on a deterministic Weather-app task, not an independent measurement. ↩↩↩↩↩

  20. Claude Code CHANGELOG. v2.1.212 (2026-07-16): “MCP tool calls running longer than 2 minutes now move to the background automatically so the session stays usable; configure the threshold or disable with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS.” v2.1.206 (2026-07-09): “Fixed MCP servers configured via --mcp-config or .mcp.json ignoring a per-server request_timeout_ms, which caused long-running MCP tool calls to time out at the 60s default in fresh sessions.” v2.1.181 (2026-06-17): “Added sandbox.allowAppleEvents opt-in setting that lets sandboxed commands send Apple Events on macOS” and “Fixed open, osascript, and browser-based auth flows failing with error -600 on macOS by adding the Apple Events entitlement.” v2.1.219 (2026-07-24): “Added HTTP status and error text to claude mcp list and /mcp when a server fails to connect”; “Added a warning for MCP config values with hidden leading or trailing whitespace”; “Added mcp_server_errors to the headless stream-json init event, listing --mcp-config entries skipped”; and “Added sandbox.network.strictAllowlist setting to deny non-allowlisted hosts for sandboxed commands.” v2.1.220 (2026-07-25): “Bug fixes and reliability improvements” only. Changelog text verified 2026-07-21; v2.1.218-v2.1.220 entries verified 2026-07-25. ↩↩↩↩↩

  21. XcodeBuildMCP v2.7.0 release, 2026-07-23; npm latest verified 2026-07-24 (npm view xcodebuildmcp dist-tags.latest → 2.7.0, published 2026-07-23T14:07Z). Cited from the release notes: Xcode 27 Device Hub — “UI automation tools now work fully with Xcode 27 simulators through Device Hub, including simulator window launching and keyboard controls”; breaking — build and test tools return schemaVersion: 3, affecting validators pinned to version 2; behavior — “Build, test, clean, and app-path commands now honor the scheme action’s configuration when configuration is omitted instead of always using Debug”; plus .xctestproducts reusable test-preparation packages, the xcodebuildmcp purge workspace-storage command (dry-run by default), session-default extraArgs with per-call overrides, and “Fixed MCP clients waiting 10–17 seconds for tools to become available, which could make short health checks report a failed connection.” Repo home: the npm repository field points at github.com/getsentry/XcodeBuildMCP and github.com/cameroncooke/XcodeBuildMCP returns a 301 redirect to it (both checked 2026-07-24) — cite the getsentry URL. Tool count: the release notes state no count and the official docs (xcodebuildmcp.com/docs/tools) still advertise “All 82 tools” (fetched 2026-07-24); cross-checked in this session with a like-for-like stdio tools/list against xcodebuildmcp@2.6.2 mcp and @2.7.0 mcp (same 12 workflows enabled, serverInfo.version confirmed for each): both returned byte-identical tool inventories (76 exposed in this environment — the advertised 82 includes environment-predicated tools), and xcodebuildmcp tools at 2.7.0 still reports 100 commands, 72 canonical, across the same 12 categories. The 82-across-12 inventory therefore carries to v2.7.0 unchanged. ↩↩↩↩↩↩

  22. Apple, “Xcode 27 Release Notes”, read from the DocC JSON on 2026-08-16 (the HTML page renders client-side and returns no text to fetchers). Beta 5 (27A5237l, 2026-08-10), verbatim: “Coding Intelligence agents can now verify watchOS apps, including rotating and pressing the Digital Crown, and pressing the side and Action buttons (Apple Watch Ultra). (181147968)” and “Xcode 27 Beta 5 adds a preview of a new MCP server experience that runs without requiring an open Xcode workspace… You can turn this experience on by using sudo xcrun mcp-server enable. Check its state afterward with xcrun mcp-server status… Developers running agents in unattended environments can approve all permissions upfront with sudo xcrun mcp-server enable --unsafe-always-allow-all-agents. This is not a recommended configuration for at-desk use. (181836944)”. Beta 1 (2026-06-08): plug-ins with skills, MCP servers, and ACP configurations (178289210); filesystem-access security layer (178289431); simulator boot, install, launch, touch synthesis, and screenshot capture (175179787); MCP debugger, scheme, and build-settings/entitlements/Info.plist tools (176935844); first-class planning (172857081); project insights (177568662). Beta 2: “LLDB now ships with an MCP server (lldb-mcp)” (176901842). Build numbers and dates cross-checked against Apple Developer Releases. ↩↩↩↩↩↩↩↩↩

  23. OpenAI, Codex models (canonical target of the redirect from developers.openai.com/codex/models), fetched 2026-08-16. Recommended: “5.6 Sol — Flagship GPT-5.6 model with the strongest capability for complex coding, computer use, research, and cybersecurity”; “5.6 Terra — Balanced GPT-5.6 model for everyday work”; “5.6 Luna — Fast and affordable GPT-5.6 model”. GPT-5.3 Codex Spark is a text-only research preview. The page states GPT-5.4 and GPT-5.4-mini retire from Codex on August 31, 2026, with 5.6-terra and 5.6-luna as the replacements. Neither GPT-4o nor o3 appears as a Codex model. ↩↩

  24. Apple Developer releases feed. iOS 26.6 (23G71), iPadOS 26.6 (23G71), macOS 26.6 (25G72), tvOS 26.6 (23L773), visionOS 26.6 (23O770), and watchOS 26.6 (23U67) all dated Mon, 27 Jul 2026. The July 20 iOS 26.6 RC carried the same 23G71 build number, so the RC shipped as the stable release. Xcode 27 beta 4 (27A5228h) dated Mon, 20 Jul 2026 is still the newest Xcode entry. Verified against the releases RSS feed 2026-07-29. ↩

  25. Anthropic, “Introducing Claude Opus 5” (2026-07-24) and the models overview. Claude Opus 5 (claude-opus-5): 1M-token context window (the default as well as the maximum), 128K max output, $5 / $25 per MTok — the same base pricing as Opus 4.8 — with fast mode at $10 / $50, and a May 2026 reliable knowledge cutoff. effort defaults to high on the Claude API and in Claude Code. Claude Code CHANGELOG v2.1.219 (2026-07-24): “Added Claude Opus 5 (claude-opus-5), now the default Opus model — 1M context, fast mode at $10/$50 per Mtok.” Opus 4.7 was removed from fast mode; /fast now applies to Opus 5 and Opus 4.8. Verified 2026-07-25. ↩

  26. MobileBuildMCP v2.7.1 release, published 2026-09-23: “Renamed the project from XcodeBuildMCP to MobileBuildMCP. The npm package, CLI binaries (mobilebuildmcp, mobilebuildmcp-doctor), Homebrew formula, MOBILEBUILDMCP_* environment variables, mobilebuildmcp:// resource URIs … the .mobilebuildmcp/config.yaml project config directory, and the ~/Library/Developer/MobileBuildMCP state directory all use the new name,” and “The env and testRunnerEnv inputs on build, launch, test, and session-default tools are arrays of { "key": "...", "value": "..." } entries, while xcode_ide_call_tool.arguments is a JSON object string.” Checked November 25, 2026: the npm registry lists mobilebuildmcp latest 2.7.1 (published 2026-09-23) and xcodebuildmcp latest 2.7.0 (2026-07-23) with no deprecation field; npx -y xcodebuildmcp@latest tools still ran. The repository at the v2.7.1 tag holds 82 tool manifests, the same file list as v2.7.0, and 15 workflow manifests (the 12 selectable categories plus session management, the doctor, and experimental workflow discovery, which the server includes by its own rules); its src/ contains no XCODEBUILDMCP_ reference. npx -y mobilebuildmcp@2.7.1 tools printed “Available tools (72 canonical, 100 total)” across 12 categories. Install commands are from the README; the Homebrew tap carries both a mobilebuildmcp (2.7.1) and an xcodebuildmcp (2.7.0) formula. ↩↩↩↩↩↩↩↩↩↩↩

  27. Apple, “Xcode 27.3 Beta 2 Release Notes”, read from the DocC JSON on November 25, 2026. “Xcode 27.3 beta 2 includes Swift 6.4 and SDKs for iOS 27.3 … requires a Mac running macOS Tahoe 26.6 or later.” Items cited: 185837709, 184511781, 184951217, 187385971, 182217728, 184951123, 95593221, 111337953, 187122954. Xcode 27.3 beta 2 (27C5035i) is dated November 16, 2026 in the Apple Developer releases feed. ↩↩↩↩↩

  28. Apple, Apple security releases: “iOS 27 and iPadOS 27” and “Xcode 27” dated 14 Sep 2026, “iOS 27.2 and iPadOS 27.2” 26 Oct 2026, “Xcode 27.2” 29 Oct 2026, “iOS 27.2.1 and iPadOS 27.2.1” 09 Nov 2026. Apple Developer releases feed: Xcode 27 (27A266a) September 14, Xcode 27.1 (27A9275) October 15, Xcode 27.2 (27B52) October 29, iOS 27.2.1 (24B156) November 9, and iOS 27.3 beta 2 v2 (24C5049f) November 19, 2026. Both read November 25, 2026. xcodebuild -version on the Mac this guide is written on returned Xcode 27.2, build 27B52, the same day. ↩↩↩↩↩

  29. Apple, “Xcode 27.2 Release Notes” (Project Format, 184661114; RenderPreview render destinations, 186442676; “Xcode 27.2 requires a Mac running macOS Tahoe 26.6 or later”) and “Updating your Xcode project configuration file format”: “In Xcode 27.2 and later, the default project configuration file is a smaller, hierarchical, self-describing JSON file with a .xcproj extension. Xcode 27 and later supports both file formats so you can choose the format you prefer. For projects you created using earlier releases, you can switch to the new JSON file format.” The format is published as open source at apple/xcode-project-format. Both read from the DocC JSON on November 25, 2026. ↩↩↩↩↩

  30. Apple Developer News, “Siri AI is now open to all developers”, November 3, 2026, read November 25, 2026. ↩↩

  31. Apple Developer News, “Updates to Device Control and Data Access, and Full Disk Access in macOS”, November 16, 2026, and “Updates to Full Disk Access in macOS”, October 2, 2026. Both read November 25, 2026. ↩↩↩

  32. Claude Code CHANGELOG, read November 25, 2026 (latest 2.1.332, published November 24). v2.1.280 (2026-09-22): “Added Claude Opus 5.5 (claude-opus-5-5), now the default Opus model,” with a 1M context window. v2.1.217: “Added a cap on concurrently-running subagents (default 20, override with CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS).” The model configuration docs list Opus 5.5 as the default on Pro, Max, Team, Enterprise, and the Anthropic API. ↩↩↩

  33. Claude Code docs, Hooks reference (each matcher group holds a hooks array of handlers such as { "type": "command", "command": "..." }) and Subagents (tools as a comma-separated allowlist; mcp__github__* to “give the subagent every tool from one server”; @agent-<name> to invoke one), read November 25, 2026. On feedback from PostToolUse, the hooks reference says plain-text stdout is added as context for Claude on UserPromptSubmit, UserPromptExpansion, SessionStart, and PostModelSwitch; that exit code 2 on PostToolUse “Shows stderr to Claude; the tool already ran”; and that “Claude Code doesn’t run a PostToolUse hook matching Edit|Write when a Bash command or a process outside Claude Code rewrites the same file.” Its JSON alternative for PostToolUse is decision: "block" with a reason, or hookSpecificOutput.additionalContext. I piped sample tool input through every hook command in this guide the same day. The file-path blocks exited 2 for paths ending in .pbxproj and paths inside .xcodeproj/, and 0 for a .swift path. The Bash blocks exited 2 for a sed -i and a cat that named project.pbxproj, and 0 for xcodebuild -project Return.xcodeproj and git status. SwiftLint is not installed on this Mac and the test could not build a project, so the SwiftLint and auto-build commands ran against stand-in swiftlint and xcodebuild scripts: with lint output or a failing build they exited 2 with the text on stderr, and otherwise exited 0 in silence. No hook was run inside a live Claude Code session for this check. ↩↩↩↩↩↩↩↩

  34. The catalog change is commit 6ae30bd1, “Add GPT-6.2 Sol and Astra to model catalogs (#62106)”, in the rust-v0.169.0 to rust-v0.169.1 comparison; codex-rs/models-manager/models.json lists gpt-6.2-sol first from that tag on. The v0.169.1 release notes do not mention it, and the rust-v0.171.0 release notes of 2026-11-20 carry the line: “Added GPT-6.2 Sol and Astra to model catalogs, with Sol as the default catalog selection. (#62106)”. rust-v0.172.0 was published 2026-11-24 and is npm latest for @openai/codex. OpenAI, Models: “For demanding work across code, apps, or research, choose GPT-6.2 Astra”; “Choose GPT-6.2 Sol for everyday coding”; “GPT-6.1 Terra is a fast, efficient choice”; “Luna suits focused, repeatable tasks”; “GPT-5.3-Codex-Spark retired on September 14, 2026.” Hooks history is from the release notes: rust-v0.114.0 (2026-03-11), “Added an experimental hooks engine with SessionStart and Stop hook events,” and rust-v0.124.0 (2026-04-23), “Hooks are now stable, can be configured inline in config.toml and managed requirements.toml, and can observe MCP tools as well as apply_patch and long-running Bash sessions.” The rust-v0.119.0 notes have no hooks entry. Also Hooks (14 events listed), AGENTS.md (“Codex reads AGENTS.md files before doing any work”), and Subagents (“Current Codex releases enable subagent workflows by default”). On accounts, Authentication: “Sign in with ChatGPT for subscription access” and “Sign in with an API key for usage-based access,” both supported by Codex CLI. All read November 25, 2026. ↩↩↩↩↩

  35. Author’s measurement, November 25, 2026: the tools a Claude Code 2.1.332 session listed for the xcode server (xcrun mcpbridge) on Xcode 27.2 (27B52), 54 in total, with descriptions quoted from the tool definitions the server sent. The list has RunCodeSnippet and no ExecuteSnippet or XcodeListNavigatorIssues. I read the definitions and did not call the project-modifying tools. ↩↩↩↩↩↩

  36. Claude Code docs, read November 25, 2026. Run Claude Code programmatically: “In a Manual mode claude -p run, a call that needs approval is denied unless something approves it”; “Without --bare, a -p session runs the hooks in a project’s .claude/settings.json”; and its examples pass --allowedTools and --permission-mode acceptEdits to claude -p. Choose a permission mode: “acceptEdits mode lets Claude create and edit files in your working directory without prompting”; “In addition to file edits, acceptEdits mode auto-approves common filesystem Bash commands: mkdir, touch, rm, rmdir, mv, cp, and sed,” which like file edits “applies only to paths inside your working directory or additionalDirectories”; in dontAsk mode, where “Claude still runs actions that need no approval in Manual mode, such as file reads inside your working directories and read-only Bash commands,” “Claude Code auto-denies every tool call that would otherwise prompt you”; the row “Run fully unattended inside a container” pairs claude -p "<prompt>" --dangerously-skip-permissions with “Required: a container, VM, or the sandbox runtime”; and on bypassPermissions, to which the page says the flag is equivalent: “Only use this mode in isolated environments like containers, VMs, or dev containers without internet access, where Claude Code cannot damage your host system.” Configure permissions: “To match every tool from an MCP server, write mcp__<server>__*. To match one tool, write its full name, mcp__<server>__<tool>”; “Edit rules apply to all built-in tools that edit files”; “Read and Edit deny rules apply to Claude’s built-in file tools,” with the Bash coverage and limits quoted in the hook section. claude --help on 2.1.332 lists --allowedTools and --permission-mode. The batch example was not run for this check. ↩↩↩↩↩

  37. SwiftLint CHANGELOG, read November 25, 2026. 0.56.0, Breaking: “The deprecated --path and --in-process-sourcekit arguments have now been removed completely.” 0.48.0: “Deprecate the --path options for lint/analyze commands. Prefer the positional paths that can be added last to both commands.” The README describes running swiftlint in the directory that holds the files and does not show the single-file form, so the flags are from the source at the 0.65.1 tag (the latest release, 2026-08-21): Lint.swift declares the positional paths argument and the --quiet flag, --strict “Upgrades warnings to serious violations (errors),” and LintOrAnalyzeCommand.swift calls exit(2) when the number of serious violations is above zero. On excluded files, at the same tag: LintOrAnalyzeArguments.swift describes --force-exclude as “Exclude files in config excluded even if their paths are explicitly specified”; Configuration+LintableFiles.swift applies no exclusion to a single Swift file path unless that flag is set; and Configuration+CommandLine.swift throws a usage error beginning “No lintable files found at paths:” when the file list is empty and allow_zero_lintable_files is off, a key the README’s sample configuration describes as “If true, SwiftLint will not fail if no lintable files are found.” The excluded-file behavior is read from that source and was exercised with a stand-in script that prints the same error. SwiftLint is not installed on the Mac this guide is written on, so the hook was not run against the real binary. ↩↩↩↩

  38. Claude Code docs, read November 25, 2026. Quickstart lists what you need: “A Claude subscription (Pro, Max, Ultra, Team, or Enterprise), Claude Console account, or access through a supported cloud provider.” Connect Claude Code to tools via MCP: “Local scope is the default. A local-scoped server loads only in the project where you added it and stays private to you,” and to share a server with a team, “add --scope project, or add the entry under mcpServers in .mcp.json at your project root and commit it.” claude mcp add --help on 2.1.332: -s, --scope <scope>, “Configuration scope (local, user, or project) (default: “local”)”. ↩↩↩

  39. Read on the Mac this guide is written on, Xcode 27.2 (27B52), November 25, 2026. man xcodebuild: simulator destinations take a name or an id, and “To build against a platform generically instead of a specific device, the destination specifier may be prefixed with the optional string “generic/”“. xcodebuild -help: -showdestinations (“display a list of destinations”), -quiet (“do not print any output except for warnings and errors”), and -exportArchive with an export option destination whose values are export or upload. xcrun altool --help lists --validate-app and --upload-package. xcrun simctl help shutdown: “Usage: simctl shutdown | all”. xcrun simctl list devices available showed iPhone 18 Pro and iPhone 17 Pro devices under iOS 27.2 and no device named iPhone 16 Pro. xcrun xctrace help lists triage (“Triage a recorded trace for hangs”) and show (“Show a call tree, summary, or list detail from a trace”), and both accept --format [text|markdown]. The plugin directory Xcode 27.2 built for Claude Code holds 16 skills, one of them xctrace, whose references include xctrace-hangs-triage.md. ↩↩↩↩↩↩

  40. Apple Developer News, “Upcoming Requirements”. The 2026-04-28 entry: “Apps uploaded to App Store Connect must be built with Xcode 26 or later using an SDK for iOS 26, iPadOS 26, tvOS 26, visionOS 26, or watchOS 26.” macOS is not in the listed platform set on this requirement. ↩

  41. Apple, “Xcode 26.5 Release Notes” and “Xcode 26.5 (17F42) - Releases”. Xcode 26.5 was listed by Apple on 2026-05-11 with build 17F42. Two Coding Intelligence features cited from release notes: messages can be queued in the coding assistant without waiting for the current response to finish (174563016), and agents can ask clarifying questions to gather context before proceeding (175182375). Also includes StoreKit Testing support for 12-month-commitment monthly subscriptions (PricingTerms model, billingPlanType PurchaseOption, CommitmentInfo on Transaction and SubscriptionRenewalInfo) and a Swift debugger fix for stepping through Swift Tasks that migrate threads during async/await operations. Current-session verification on 2026-05-24: xcodebuild -version returned Xcode 26.5 and Build version 17F42; npm view xcodebuildmcp version dist-tags.latest time.modified --json returned latest 2.5.2 with time.modified 2026-05-12T07:40:41.737Z. See also: 9to5Mac, “Xcode 26.5 adds two features that make agentic coding more useful”, 2026-05-12. ↩↩↩↩

  42. Apple, “Xcode 26.4 Release Notes”. Xcode 26.4 (2026-03-24, build 17E192). Features cited from release notes: Swift Testing now supports image attachments via CGImage, NSImage, UIImage, and CIImage; Issue.record accepts severity levels; some UI-test app crashes — specifically apps interacted with through XCUIApplication(bundleIdentifier:) or XCUIApplication(url:) — are reported as warnings with attached crashlogs rather than failing the test; the String Catalog editor adds cut/copy/paste of entries, language removal, and pre-fill translations from an existing language, plus the BUILD_ONLY_KNOWN_LOCALIZATIONS setting. ↩

  43. Apple Developer News, “Xcode 26.4.1 (Build 17E202) Now Available”, 2026-04-16. Bug-fix dot release only — fixes a MetricKit crash from missing symbols on iOS / macOS / visionOS pre-26.4, and a Swift async stack-allocation bug (“freed pointer was not the last allocation” in swift_asyncLet_finish). ↩

  44. getsentry/XcodeBuildMCP v2.1.0 release, 2026-02-23, added the init command, replacing the standalone install-skill.sh script. Current behavior is from mobilebuildmcp init --help at v2.7.1, run November 25, 2026 (“Install MobileBuildMCP agent skill”; --client choices auto, claude, agents; --skill choices mcp, cli, default cli; --print; --uninstall), and the project’s Agent Skills page, which says Claude Code “already receives equivalent guidance via server instructions.” That page lists cursor and codex as --client values; the v2.7.1 binary’s help does not. ↩

  45. InfoQ, “Apple Improves Context Window Management for its Foundation Models”, March 23, 2026: “While the current maximum is 4096 tokens, contextSize removes the need to hardcode that limit.” The article reports both additions as @backDeployed. The FoundationModels interface in the iOS 27.2 SDK (Xcode 27.2, 27B52), read November 25, 2026, marks contextSize @backDeployed(before: iOS 26.4, macOS 26.4, visionOS 26.4) and declares each tokenCount(for:) overload @available(iOS 26.4, macOS 26.4, visionOS 26.4, *), async throws, with no back-deployment; Apple’s Foundation Models documentation lists tokenCount(for:) from iOS 26.4. This guide follows the SDK. ↩↩

  46. File counts derived from find . -name '*.swift' -not -path '*/Tests/*' | wc -l run against each of the eight private app repositories on 2026-04-27. Test files excluded. Total is internally consistent with the per-app breakdown table in §The Portfolio. ↩

  47. Subjective wall-clock estimate, not a measurement against a control group. The 3-5x figure is the author’s recall of time-to-feature comparisons between agent-assisted features in 2026 and equivalent solo features shipped in the same codebases prior to the agent workflow. Treat it as a heuristic for what to expect after MCP + hook setup, not as a benchmark. ↩

  48. Anthropic, anthropics/claude-plugins-official, .claude-plugin/marketplace.json at commit 43fd1f9, read November 10, 2026: the xcode entry (author “Apple Inc.”, source command, xcrun agent plugin path --plugin-format claude, mode link), added by pull request #6338, merged November 6, 2026 (UTC). The skill count, the plugin directory contents, and the hidden Xcode hang are the author’s measurements on Xcode 27.2 (27B52), on one Mac with Xcode’s headless MCP preview turned on, documented in Xcode 27 Ships Agent Skills You Can Export Anywhere. ↩↩

  49. Anthropic, Claude Code changelog, version 2.1.229 (August 12, 2026): plugin marketplace command sources, where a local command prints the plugin directory and mode: "link" uses it in place. The message the install printed is as observed on Claude Code 2.1.322. ↩↩