r/iOSProgramming • u/Puzzled-Stick9170 • 8h ago
Discussion Let Claude Code test your iOS app once on the Simulator or a real iPhone, then replay it in CI forever with zero tokens (open source, 3x faster than agent-device)
I built phonedriver, a free open-source tool (Rust + a tiny Objective-C XCTest runner, zero telemetry) that lets Claude Code, Codex, Cursor, or plain scripts test iOS apps on the Simulator or a real iPhone (and android) over USB or Wi-Fi.
Instead of feeding screenshots on every turn or writing flaky XCTest UI code by hand, phonedriver sends the model a short numbered text list of the screen (59 tokens for a sign-in view) and returns only the lines that changed after each tap (20 tokens). Once an agent tests a flow and it passes, you save it and replay it in CI with no model at all:
phonedriver save login.steps
phonedriver replay login.steps --screens screens/loginOn simulator-use's iOS Simulator sign-in benchmark (time and reply tokens):
| Step | phonedriver | simulator-use | agent-device |
|---|---|---|---|
| Read screen | 29 ms (59 tok) | 45 ms (71 tok) | 33 ms (125 tok) |
| Tap + settle | 316 ms (20 tok) | 435 ms (17 tok) | 872 ms (38 tok) |
| Type email | 848 ms (13 tok) | 578 ms (14 tok) | 2.43 s (47 tok) |
| Full sign-in (step by step) | 1.75 s (173 tok) | 1.78 s (192 tok) | 5.67 s (762 tok) |
| MCP tool list (paid every turn) | 17 tools (1,849 tok) | 12 tools (2,443 tok) | 63 tools (27,918 tok) |
Four Xcode and Simulator quirks that got it there:
- XCTest spends ~330 ms before the app sees a tap. Sending Simulator taps straight through SimulatorKit's HID port (the path
idbuses) delivered the touch in a few milliseconds, dropping tap-and-settle from 0.84 s to 0.32 s. - HID typing is fast and silently wrong. Sixteen characters went in under 10 ms, but
x "q" 'r' -- teh ok. Gary@Mail.comcame out asx ‘q’ ‘r’ — teh ok. gary2mail.combecause apps dropped Shift and applied smart punctuation when the hardware keyboard was off. Typing stays on XCTest instead (simulator-usebeats phonedriver on Simulator typing because hardware keys hide the software keyboard, while XCTest keeps it up like a real iPhone). - Xcode recorded QuickTime video of every runner session. Long-running UI tests default to
PreferredScreenCaptureFormat = screenRecording. My Simulator'stestmanagerdfolder held 154 movies up to 209 MB each (1.2 GB total), and 84DerivedDatafolders took another 940 MB. SettingsystemAttachmentLifetime = keepNeverandpreferredScreenCaptureFormat = screenshotsin the scheme's test action stopped it. - Fast accessibility reads without WebDriverAgent. Calling
XCAXClient_iOSdirectly read an iPhone 17 Simulator screen in 22 ms vs 380 ms for WDA at depth 30 (45 ms with every WDA option tuned).
Install in one line: brew install hridaya423/tap/phonedriver or npx -y phonedriver init
Site: https://phonedriver.dev
Repo: https://github.com/hridaya423/phonedriver
Benchmarks & raw runs (including the steps I lose): https://phonedriver.dev/benchmarks/#simulator
If you run long Xcode UI test suites, check your Simulator's testmanagerd folder. Mine was quietly holding over a gigabyte of .mov files too lol