Skip to content

[Bug]: Weird toggle bug? #117

@ariccio

Description

@ariccio

Bug Description

Unlike windows & MSVC, I'm still a terrible SwiftUI-on-iOS programmer, so I don't know yet for sure if this is a bug with XCodeBuildMCP, an axe bug, or a bug with SwiftUI that I don't see yet.

I'm also not good enough yet with this awesome MCP to use reloaderoo, even though it's been on the back of my mind for weeks now, for context optimization reasons.

This thing-that-appears-to-be-a-bug is with SwiftUI toggle buttons. It SEEMS like certain toggle elements need different handling in the automated interaction. I'm not sure if it's because XCodeBuildMCP doesn't use axe correctly, or if axe doesn't support this yet.

Debug Output


⏺ XcodeBuildMCP - doctor (MCP)(enabled: true)
  ⎿  XcodeBuildMCP Doctor                                                                                                                                                                                                                

     Generated: 2025-09-30T15:57:43.849Z
     Server Version: 1.14.1

     ## System Information
     - platform: darwin
     - release: 24.6.0
     - arch: arm64
     - cpus: 8 x Apple M2
     - memory: 24 GB
     - hostname: Alexanders-MacBook-Pro.local
     - username: alexanderriccio
     - homedir: /Users/alexanderriccio
     - tmpdir: /var/folders/_4/zrj460q97l5cctkts4s8srw00000gn/T

     ## Node.js Information
     - version: v20.19.4
     - execPath: /Users/alexanderriccio/.nvm/versions/node/v20.19.4/bin/node
     - pid: 75045
     - ppid: 74791
     - platform: darwin
     - arch: arm64
     - cwd: /Users/alexanderriccio/Documents/GitHub/DeeDee-todo-work
     - argv: /Users/alexanderriccio/.nvm/versions/node/v20.19.4/bin/node /Users/alexanderriccio/.npm/_npx/99336612077b7094/node_modules/.bin/xcodebuildmcp

     ## Xcode Information
     - version: Xcode 26.0.1 - Build version 17A400
     - path: /Applications/Xcode.app/Contents/Developer
     - selectedXcode: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
     - xcrunVersion: xcrun version 72.

     ## Dependencies
     - axe: ✅ Bundled
     - xcodemake: ❌ Not found
     - mise: ❌ Not found

     ## Environment Variables
     - INCREMENTAL_BUILDS_ENABLED: (not set)
     - DEVELOPER_DIR: (not set)
     - HOME: /Users/alexanderriccio
     - USER: alexanderriccio
     - TMPDIR: /var/folders/_4/zrj460q97l5cctkts4s8srw00000gn/T/
     - NODE_ENV: (not set)
     - SENTRY_DISABLED: (not set)
     - XCODEBUILDMCP_ENABLED_WORKFLOWS: simulator,project-discovery,ui-testing,logging,utilities,doctor
     - XCODEBUILDMCP_DYNAMIC_TOOLS: false
     - XCODEBUILDMCP_SILENCE_LOGS: true

     ### PATH
     ```
     /Users/alexanderriccio/.npm/_npx/99336612077b7094/node_modules/.bin
     /Users/alexanderriccio/Documents/GitHub/DeeDee-todo-work/node_modules/.bin
     /Users/alexanderriccio/Documents/GitHub/node_modules/.bin
     /Users/alexanderriccio/Documents/node_modules/.bin
     /Users/alexanderriccio/node_modules/.bin
     /Users/node_modules/.bin
     /node_modules/.bin
     /Users/alexanderriccio/.nvm/versions/node/v20.19.4/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin
     /Users/alexanderriccio/.pyenv/shims
     /Users/alexanderriccio/.pyenv/bin
     /Users/alexanderriccio/.nvm/versions/node/v20.19.4/bin
     /Users/alexanderriccio/.rbenv/shims
     /usr/local/bin
     /Library/Frameworks/Python.framework/Versions/3.12/bin
     /opt/homebrew/bin
     /opt/homebrew/sbin
     /usr/local/bin
     /System/Cryptexes/App/usr/bin
     /usr/bin
     /bin
     /usr/sbin
     /sbin
     /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
     /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
     /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
     /Library/Apple/usr/bin
     /Library/TeX/texbin
     /Applications/nmap.app/Contents/Resources/bin
     /Applications/ncat.app/Contents/Resources/bin
     /Applications/nping.app/Contents/Resources/bin
     /Applications/zenmap.app/Contents/Resources/bin
     /opt/homebrew/opt/bison/bin
     /Users/alexanderriccio/Library/Android/sdk/platform-tools
     /usr/local/opt/postgresql@14/bin
     /Users/alexanderriccio/.cargo/bin
     /Applications/Visual Studio Code.app/Contents/Resources/app/bin
     /Applications/Visual Studio Code.app/Contents/Resources/app/bin
     /Users/alexanderriccio/.local/bin
     /Applications/Visual Studio Code.app/Contents/Resources/app/bin
     /Users/alexanderriccio/.local/bin
     ```

     ## Feature Status

     ### UI Automation (axe)
     - Available: ✅ Yes
     - UI Automation Supported: ✅ Yes

     ### Incremental Builds
     - Enabled: ❌ No
     - Available: ❌ No
     - Makefile exists: ❌ No

     ### Mise Integration
     - Running under mise: ❌ No
     - Mise available: ❌ No

     ### Available Tools
     - Total Plugins: 83
     - Plugin Directories: 12
     - device: 14 tools
     - discovery: 1 tools
     - doctor: 1 tools
     - logging: 4 tools
     - macos: 11 tools
     - project-discovery: 5 tools
     - project-scaffolding: 2 tools
     - simulator: 19 tools
     - simulator-management: 8 tools
     - swift-package: 6 tools
     - ui-testing: 11 tools
     - utilities: 1 tools

     ### Runtime Tool Registration
     - Mode: static
     - Enabled Workflows: 12
     - Registered Tools: 61
     - Workflows: device, discovery, doctor, logging, macos, project-discovery, project-scaffolding, simulator, simulator-management, swift-package, ui-testing, utilities

     ## Tool Availability Summary
     - Build Tools: ✅ Available
     - UI Automation Tools: ✅ Available
     - Incremental Build Support: ❌ Not available

     ## Sentry
     - Sentry enabled: ✅ Yes

     ## Troubleshooting Tips
     - If UI automation tools are not available, install axe: `brew tap cameroncooke/axe && brew install axe`
     - If incremental build support is not available, you can download the tool from https://github.com/cameroncooke/xcodemake. Make sure it's executable and available in your PATH
     - To enable xcodemake, set environment variable: `export INCREMENTAL_BUILDS_ENABLED=1`
     - For mise integration, follow instructions in the README.md file

⏺ The XcodeBuildMCP server is healthy and operational:

  ✓ Working:
  - Xcode 26.0.1 installed
  - 61 tools registered (simulator, UI testing, project discovery, logging, utilities)
  - UI automation (axe) bundled and ready
  - Build tools available

  Optional enhancements (not installed):
  - xcodemake: Incremental builds support
  - mise: Development environment manager

  The system is fully functional for building, testing, and UI automation tasks.

Editor/Client

Claude Code 2.0.1

MCP Server Version

1.14.1

LLM

Claude 4.5 Sonnet

MCP Configuration

{
  "mcpServers": {
    "XcodeBuildMCP": {
      "command": "npx",
      "args": [
        "-y",
        "xcodebuildmcp@latest"
      ],
      "env": {
        "XCODEBUILDMCP_ENABLED_WORKFLOWS": "simulator,project-discovery,ui-testing,logging,utilities,doctor",
        "XCODEBUILDMCP_DYNAMIC_TOOLS": "false"
      }
    }
  }
}

Steps to Reproduce

I have some code like the following

    @ViewBuilder
    private var toggleContent: some View {
        VStack(alignment: .leading, spacing: 2) {
            Text("Allow Demo Data")
                .font(.headline)

            Text(mockManager.isMockDataEnabled ?
                 (isSimulator ? "Demo data is active (you can disable it)" : "Demo data can be shown") :
                 (isSimulator ? "Demo data is disabled (you can enable it)" : "Only real data will be shown"))
                .font(.caption)
                .foregroundColor(.secondary)
        }
    }


private var mainToggleSection: some View {
Section {
Toggle(isOn: Binding(
    get: { mockManager.isMockDataEnabled },
    set: { newValue in
        updateSampleDataEnabled(newValue)
    }
)) {
    HStack(spacing: 12) {
        toggleIcon
        toggleContent
    }
}
.tint(.blue)
.accessibilityLabel("Allow Demo Data")
.accessibilityValue(mockManager.isMockDataEnabled ? "Enabled" : "Disabled")
.accessibilityHint("When enabled, the app can show example health data when real data is not available")
}
}

It displays a nice SwiftUI toggle.

Claude Code tried a bunch of things:

  1. Standard Tap - Center of toggle row (201, 353)
  2. Touch Down/Up Separately - With 500ms delay between events
  3. Multiple Coordinates:
    • Left side (label): (60, 353)
    • Right side (switch): (360, 353)
    • Far right: (350, 353)
  4. Tap with Pre-delay - 1 second pre-delay
  5. Long Press - 500ms duration
  6. Swipe with Minimal Distance - 2px

Claude code also reported the following:

**Toggle State Verification**:
- Initial state: `"AXValue": "Disabled"`
- After ALL tap attempts: Still `"AXValue": "Disabled"`
- State never changed despite multiple interaction attempts

Manually inspecting some of the describe_ui results shows the UI object looks like:

               {
                 "AXFrame" : "{{16, 311.99999999999994}, {370, 82.666666666666686}}",
                 "AXUniqueId" : null,
                 "frame" : {
                   "y" : 311.99999999999994,
                   "x" : 16,
                   "width" : 370,
                   "height" : 82.666666666666686
                 },
                 "role_description" : "switch",
                 "AXLabel" : "Allow Demo Data",
                 "content_required" : false,
                 "type" : "CheckBox",
                 "title" : null,
                 "help" : "When enabled, the app can show example health data when real data is not available",
                 "custom_actions" : [

                 ],
                 "AXValue" : "Disabled",
                 "enabled" : true,
                 "role" : "AXCheckBox",
                 "children" : [

                 ],
                 "subrole" : "AXSwitch",
                 "pid" : 37617
               }

Expected Behavior

Claude code able to toggle the toggle

Actual Behavior

Claude Code does the typical AI struggling routine for a very long time, eventually giving up and just producing subtly-BS code,, and can only properly proceed if I notice it and manually toggle it.

Error Messages

Various polite versions of a cranky LLM

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstale

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions