---
title: "Recipe: driving iOS"
description: "Check a screen against a reference with compare, not by eye: bun exact.mjs agent ios captures as a device does and says where they differ."
modificationDate: "2026-11-25"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipe: driving iOS

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/recipes/ios-driving: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

**Compare with a reference**: `bun exact.mjs agent ios --touch platform … "clock settle"
"screenshot .exact/x.png compare ref/x.png"` includes the keyboard on a simulator it boots.
Differences are grouped by node (`x.side.png` pairs both images, `x.diff.png` adds the diff).
Set the status bar with `xcrun simctl status_bar <udid> override --time 9:41`.
Real taps reach menus, tabs, alerts and native module controls. Omit the flag for an offscreen menu row.

**Context menus**: with `--touch platform`, hold `tap <source> drag 0 0 press 1000`, then
`clock settle`. Select with `tap <action>`, or dismiss with `tap <root> at <x> <y>` on UIKit's
backdrop outside the menu and preview; `clock settle` after either. Use `layout` for offsets
from the root's box. `tap <source> contextmenu` delivers only the recognized event.

Check on the web (`verify`); end with `verify ios`: UIKit bars, light and dark, and a relaunch
([tests](https://exact.expo.dev/recipes/tests.md#before-you-call-it-done)). Stale drives build first; `--prebuild` starts early.
With TypeScript data, edits to `.contract`, `app.ts` and its imports reach iOS as a baked plan
(log `.exact/ios-plan.log`). Manifest, asset, font, grant, `appId`, canvas and Rust data edits
rebuild the app.

`back` dismisses or pops. `type <root> <path>` opens a route from the `navigate=`
node’s testId. A compare starts with empty storage.

```prompt Check my app's screens on iOS
Drive the Exact app in this folder on the iOS simulator: visit each screen, check it, and compare it with a reference picture when I give one. Use https://github.com/expo/exact/blob/main/docs/recipes/ios-driving.md as the source for each step. The Exact checkout has the same page at docs/recipes/ios-driving.md.

1. If this folder is not an Exact app (it has no exact.mjs and app.contract), stop and tell me.
2. If I did not say which screens to visit, list the app's routes, sheets and alerts, and ask me. If I gave no reference pictures (the original's screenshots, a design), ask me whether I have them and where they are. An iOS simulator needs macOS: on another system, stop and tell me.
3. Visit each screen with `bun exact.mjs agent ios "<op>" "<op>"`. Drive controls by `testId`. `type <root> <path>` opens a route (`<root>` is the testId of the `navigate=` node). `back` closes an alert or a sheet, or pops a screen. Put `clock data` after an op whose reply the next op reads, and `clock settle` after a transition.
4. On each screen, run `check both`. It says what is wrong: clipped text, a scroller squeezed below one row, a covered control, a small target, low contrast. Fix each finding in the app.
5. For each reference, add `--touch platform`, then take `"screenshot .exact/<name>.png compare ref/<name>.png"` after `clock settle`. It reports the differences by node, and `<name>.diff.png` draws the reference, the screen and the differences. A drive that compares starts its store empty. Tell me each difference before you change a screen to match.
6. With `--touch platform`, real taps reach menus, tabs, alert buttons and native module controls. To open a context menu, hold `tap <source> drag 0 0 press 1000`, then `clock settle`, then select with `tap <action>` and `clock settle` again. A menu row scrolled out of view takes a drive without the flag.
7. Follow the platform checks in docs/start-here.md (`bun exact.mjs docs platform checks`) for the targets in the app's AGENTS.md and app.json until they pass. Read the reports, including counted findings; a zero exit code alone does not mean clean. Fix the app, not the test. End with `bun exact.mjs verify ios`: UIKit bars, light and dark, and a relaunch. If a finding stays after three rounds of fixes, or the app had it before you changed anything, record it (step 8) and report it; do not keep trying.
8. When a doc was wrong or missing, or a step needed a workaround, read `bun exact.mjs feedback status`. Under `never`, keep no note. Otherwise record it: `bun exact.mjs feedback note "<what happened>"`, which goes to Expo only as that status says. Do not change the policy; tell me how many notes you kept.
9. Tell me each screen you visited, what `check` found and what you fixed, each difference from a reference, and what the tests and verify reported. The screenshots are in `.exact/`.
```

```sh
bun exact.mjs agent ios "clock data" "screenshot .exact/a.png compare ref/a.png" "tap add-item" \
  "clock settle" "screenshot .exact/b.png compare ref/b.png" back "type app /item/1" \
  "clock data" "clock settle" "screenshot .exact/c.png compare ref/c.png"
```

| Flag or op | What it does |
| --- | --- |
| `rotate` + `portrait`, `portraitUpsideDown`, `landscapeLeft` or `landscapeRight` | Wait for the simulator scene’s `screen.orientation` in `layout`. |
| `check`, `check dark`, `check both` | Clipped text, squeezed scrollers, covers, tap areas under 44×44 pt, contrast. |
| `--scale 3` | Screenshots at 3 px per point. |
| `screenshot <file> window` | Bars included; also the default with an alert, sheet or menu up. Film samples the agent clock; [UIKit motion](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/experiments/ios-film-cadence/README.md) needs a display recording. |
| `tap <id> down` `screenshot <png>` `tap up` | `<id>` shown pressed, then pressed once; `tap hold <ms>` moves the clock. |
| `clock settle` | Ends a transition, runs an `after(1, …)`; waits up to 1.5 s for UIKit's animations (4 s: a list gliding). |
| `--timing platform`, `--touch platform` | UIKit's own transition timing (default: frozen); real taps and drags. |
| `--sim <udid\|name>` (`EXACT_SIM`) | Simulator (default: the app’s). |

- Drive controls by `testId` (their `accessibilityIdentifier`); `tap` and `type` scroll their
  target into view.
- A wheel or `tap <scroller> drag 0 -300` moves content (and bars) that far; a real
  drag glides unless held 100 ms ([more](https://exact.expo.dev/learn/contract-for-agents/inspection-and-testing.md#drags-on-ios)).
- Tapping an alert or action-sheet button waits for dismissal. `clock data` reads the reply.
