Skip to main content
sightmap device drives a native iOS app in the local iOS Simulator the way sightmap browser drives Chrome. It reads the app’s accessibility tree, applies your .sightmap/ corpus with the same matcher as sightmap snapshot, and acts on elements by accessibility identifier or component query. Nothing leaves the Mac except the app’s own traffic.
sightmap device needs an Apple Silicon Mac, macOS 15 or later, and Xcode 26 or later selected with xcode-select (the Command Line Tools alone are not enough). Run device doctor first.

Conventions

  • Every command takes --json (machine-readable output) and --sightmap-dir (default .sightmap). There is no upward search for the corpus, so run commands from the project root.
  • device start records the session in .sightmap/.device-session and writes one run log per run to .sightmap/.device-runs/<run>.jsonl. Add both to .sightmap/.gitignore.
  • Errors print one line, then a Next: line with the step to take.
  • Coordinates are screen points, not pixels: a 390×844 pt screen is 1170×2532 px in a screenshot.

Targets

click, fill, scroll --in, and scroll --until take one target: A target that matches several elements is an error that lists the candidates; add a predicate or append #N.

Views without routes

The spec requires a route on every view, and native screens have no URL, so native corpora use short placeholder routes such as /login. sightmap device ignores routes: a snapshot uses the view whose own components match the most elements, marked (inferred), unless you pass --view. SEP-0024 proposes a route-less screen: selector for this case; it is not part of the spec yet.

Selectors on iOS

Each element exposes a role from its accessibility type (button, text, textfield, securetextfield, switch, tab, cell, image, other, and so on), its accessibilityIdentifier as the element’s id, and the attributes text (the label) and value. Select by id. #login-submit or [id="login-submit"] is the form other tools that read the same app match too, such as a pipeline that records the app’s views. device also exposes the identifier as the attributes identifier and testid (a React Native testID arrives as the identifier), but those names are its own: a definition written with them matches only in device. Only accessible elements reach the iOS tree. An identifier on a plain wrapper view (a React Native testID on a non-accessible View, for example) never appears there, so [id="login-form"] [id="login-submit"] matches nothing. Write leaf selectors such as [id="login-submit"]. Identifiers often contain dots, which # reads as a class: escape them and single-quote the selector so YAML keeps the backslashes, as in '#product\.1'. Unescaped, #checkout.submit means id checkout with class submit and matches nothing, since native elements have no classes. A leading digit takes a hex escape, its code point followed by a space: 1.circle is '#\31 \.circle'. [id="1.circle"] selects the same element and reads more easily. Role names (the tag: navbar, tabbar, other, image, …) may still change, to agree with other sources that read native trees. Prefer ids; use a role in a selector only to tell apart elements that share an id prefix.
.sightmap/views/login.yaml

Splitting a combined label

A tappable container such as a SwiftUI NavigationLink row is one element whose label is its texts joined with ", ", so dom.text reads Trail Runner, Acme, $89.99, not three values. A pattern splits it:
.sightmap/views/products.yaml
The brand is optional, so Trail Runner, $89.99 gives title and price and no brand, and a comma inside a title with a brand stays in title. The label carries no field boundaries, though, so no pattern can tell apart two cases that read the same: a title containing a comma with no brand (Lamp, Large, $9.99 gives title="Lamp", brand="Large"), and a brand containing ", ". For an exact split, start the session with --probe, which reads each text from inside the app, or give each child its own identifier; treat a split label as a convenience for reading, not a value to assert on.

Hooks that hold outside device

A definition you write against device can also be matched by another source: a capture pipeline that reads the app’s view tree, or an SDK that records view type names. Neither reads the accessibility tree the way device does, so what device shows is not all that they can match. Why they differ. SwiftUI builds accessibility elements only while an assistive technology such as VoiceOver is running. device start turns app accessibility on in the simulator, so device sees them; code inside an app on a phone with VoiceOver off finds almost none. What to do.
  • Set .accessibilityIdentifier on each control the corpus names, and write its definition by id first. A definition that also matches elsewhere should not rest on a role, a state or text alone.
  • Treat an identifier as portable only once the other source shows it. With VoiceOver off, a reader of accessibility data inside the app gets no identifier for a TextField, a segmented Picker or a Stepper. A source that records identifiers when the app is built may get them; check there rather than assume.

device doctor

Checks macOS, Apple Silicon, xcode-select, the Xcode version, iOS Simulator runtimes and devices, and Swift, then builds the simulator helper and the in-app probe if they are not built yet. With a session running, it also reports the session’s network sources and probe. Exits 1 if any check fails.

device start

Boots the simulator, enables app accessibility, installs and launches the app, starts the session daemon, and begins a run log. The first time a simulator gets app accessibility, start reboots it once. Without --detach, start holds the shell as a foreground daemon; agents and scripts should pass --detach. On a running session, start reinstalls (with --app) and relaunches the same app; after a reinstall the network sources are chosen again for the new build. It refuses a different app or device; run device stop first. One simulator runs one session: a start from another sightmap directory on a simulator that already has one fails with session_running and names the directory to stop it from.
Apps must be built by Xcode (xcodebuild or the Xcode app) so they carry the simulated entitlements a simulator app needs.

Reading inside the app

The accessibility tree is read from outside the app, and SwiftUI joins the texts inside a row, a NavigationLink or a Button into one element whose label separates them with ”, ”. start --probe also loads a small probe into the app, which reads SwiftUI’s own view graph from inside it, and each snapshot merges two things from it onto the accessibility tree:
  • a view node for each instance of one of your view types, with type set to its name and one attribute per stored field (item.title, maker, item.price);
  • a text node for each Text in it, with field naming the stored field it shows, and for Text(value, format:) the unformatted value and a format such as currency USD.
The view[type="…"] node is experimental, and its type names are not reliable. SwiftUI’s view graph inlines your views and names them only sometimes, so a view can have a view node on one screen and none on the next, and a definition by type would match some screens and not others. view nodes are not the planned form for type names ([type="X"] on the element itself; see Hooks that hold outside device), and the probe is expected to drop them when device builds its tree from the view graph. Don’t write definitions by type yet. The text nodes and their field, value and format don’t depend on type names.
A corpus then reads each field exactly through child components, commas and all:
Without --probe the same corpus still names each row; the properties read from its Texts are absent. The Text nodes are --probe output and experimental. The accessibility tree stays the source of truth for what is on screen and tappable: the probe only adds nodes under elements whose label already contains their text, never duplicates a text the tree reports separately, and adds nothing under a secure field. Its text nodes have real frames, so click can target them. How it works and what it costs:
  • start --probe compiles the probe from source embedded in sightmap with your Xcode (one clang call, cached under ~/Library/Caches/sightmap/device/probe; device doctor builds it ahead of time; SIGHTMAP_DEVICE_PROBE names a dylib to use instead) and launches the app with DYLD_INSERT_LIBRARIES and SWIFTUI_VIEW_DEBUG set. No app code or build setting changes, and the app needs no get-task-allow. Every relaunch, restart and start --app loads it again.
  • The probe answers on a Unix socket. Right after launch the session runs a first read in the background, since SwiftUI’s first walk of its graph is slow; the first read of each new screen still takes a few seconds, and later reads of it a few hundred milliseconds. Only snapshot reads through the probe, plus click/fill when a target is not in the plain tree; the re-reads while a screen settles reuse the last read while the layout is unchanged, and hosting views off screen are skipped.
  • If the app never loads the probe (an app signed with the hardened runtime, or one that clears DYLD_* variables), start says why, snapshots carry a [Probe] note and are the plain accessibility tree, and status and doctor report it.
  • Field values go through the same redaction as network entries: a field whose name contains token, password, secret or key reads <redacted>, as do a URL’s credential query parameters. --probe-fields none leaves fields out entirely. The run log never records a probe node’s text.
The probe reads SwiftUI’s view debug data, which is undocumented and can change with any Xcode release; when it does, snapshots fall back to the plain tree. The probe reads it with Swift’s Mirror rather than SwiftUI’s own JSON encoder, which traps on some screens (a SwiftData @Query inside a NavigationStack or TabView) and takes the app down. If a read still ends the app, the session reports which hosting view it was reading, leaves that kind of view out of later reads, and you relaunch the app. UIKit-only screens gain nothing from it yet.

device status, device stop, device launch, device relaunch

status reports the session’s device, app, helper, console buffer, network sources, in-app probe (with --probe), and current run; it exits 1 when no session is running. If the app has exited or crashed, status says so, and snapshot and the actions fail with app_not_running instead of reading the home screen; relaunch brings it back. stop stops the daemon and the app and switches HAR capture back off; --shutdown also shuts the simulator down. launch brings the app to the foreground; relaunch restarts it and re-enables accessibility first.

device snapshot

Prints the annotated accessibility tree in the shape of sightmap snapshot: the view, a guide of matched components, the tree with per-snapshot ids, conflicts, and visible-only coverage. Matched elements show [Component prop="value"]; unmatched ones show role[id="…"] "label".
Extra sections appear when they apply: The corpus reloads whenever a YAML file under --sightmap-dir changes, so the next snapshot reflects your edits.

device click

Resolves the target in a fresh read of the screen, checks that its center is on screen, not under the status bar or a navigation bar or outside the visible part of its list, not under a tab bar, toolbar, navigation bar, keyboard, LogBox toast, any control drawn over it (such as a custom tab bar of plain buttons over a list), or a floating dev-menu button, and that it is enabled, then taps its center. A switch is pressed for 0.15 s instead, at the trailing end of its row when it spans one (a SwiftUI Toggle in a Form): its label ignores taps, and an iOS 26 switch ignores most instant taps. While the target is missing or the screen is still moving, it re-reads for up to 3 s first. It taps only once two reads in a row agree on where the target and the screen are, and the screen has held still for 0.75 s. Two reads alone are not enough: the accessibility tree reports where an animation ends rather than where it is drawn, so a screen presented a moment ago reads the same throughout its slide, and iOS drops touches until a presentation finishes. A tap on a screen that was already still costs no extra wait. A screen still moving, or changed too recently, when the wait runs out is refused with an unstable error instead of being tapped mid-transition.
A refused click names the reason and the fix:

device fill

Taps the target, types the text, and errors if the field does not show it. Text is appended unless you pass --clear. fill TARGET "" --clear empties a field; a field that then shows only its placeholder reports an empty value.

device scroll

Scrolls one page in a direction (up, down, left, right), or until a target is tappable. Like click, it first waits for a screen that just changed to hold still for 0.75 s, so the swipe is not dropped mid-transition. Long SwiftUI and UIKit lists only expose rows near the screen, so a row further down is not found until you scroll to it. --until scrolls slowly enough not to fling past the target and refreshes the snapshot ids when it stops.

Raw input


device console

console list reads the app’s own os_log/Logger output and its stdout and stderr, captured by the session daemon. console get N prints one entry in full. The session keeps the latest 5,000 entries (start --console-limit changes that). When a list would have reached further back, it says so: (N earlier entries dropped; …), or dropped in --json.
React Native console.log output arrives as info entries from the com.facebook.react.log subsystem.

device network

network list lists the requests the app made, oldest first, each led by the requests: definitions in your corpus that match it, as browser network list does, and trailed by the properties those definitions extract. network get N prints one entry with its headers and bodies.

Sources

The session reads the app’s traffic from the first of these sources that works; each entry’s source says which one recorded it. --network auto (the default) arms har before the app launches when the app has get-task-allow, and keeps summary as a backstop for requests HAR did not log. Without the entitlement it uses summary and looks for Metro every 2 s; once it attaches to the app’s Metro page, rn-cdp replaces summary (which would list the same JS requests with less detail) until the connection drops, and it reattaches after a relaunch. --network har, rn-cdp or summary uses that source alone; off captures nothing. device status and device doctor report which source is active and why the others are not. get-task-allow. CFNetwork logs HAR entries only for a process with this entitlement. A Debug build that Xcode signs for development carries it. A simulator build signed ad hoc (CODE_SIGN_IDENTITY = "-") does not unless you add it: point CODE_SIGN_ENTITLEMENTS at a file containing
Release and App Store builds never have it, so they fall back to summary. start reads the entitlement from the executable and, when it is missing, status says so and why. How HAR capture works. har switches on CFNetwork’s own HAR logging inside the simulator, the mechanism Instruments’ HTTP Traffic instrument uses, with private, undocumented CFNetwork preferences (har-capture-global, har-body-size-limit) and the com.apple.CFNetwork HAR log category; then it reads the simulator’s unified log. Requests already under way when capture starts are missed. stop deletes the preferences and resets the log category. The capture is leased for 10 minutes at a time and renewed while the session runs, so a session that dies leaves it on for at most 10 minutes. A future iOS release may change these switches. Only URLSession/CFNetwork traffic is visible to har and summary; raw sockets, SwiftNIO and other custom stacks are not. rn-cdp misses image loads and native modules’ requests, and requests made before it attached.

Redaction

Output hides credentials by default: the values of the Authorization, Cookie, Set-Cookie and Proxy-Authorization headers, and of any header, query parameter, form field or JSON key whose name contains token, password, secret or key (case-insensitive) become <redacted>. Properties are extracted from the redacted entry, so a property that reads a credential shows <redacted> too. --unredacted shows everything. The session keeps the latest 1,000 entries (start --network-limit) in memory, with each body capped at 256 KiB, and never writes them to disk: network entries and bodies stay out of the run log.

device run

Every action appends one JSON line to .sightmap/.device-runs/<run>.jsonl with its timestamp, sequence number, arguments, target element, view, and outcome. Another agent or tool can follow a session with run tail --follow, or poll with --since, and line up its own data with the steps by timestamp. launch and relaunch are logged as such, so a restart is told apart from a first launch.

How the simulator helper is distributed

The simulator is driven by a small Swift helper built on Meta’s FBSimulatorControl, using the prebuilt xcframeworks from the idb v1.7.7 release (arm64 only). It reads the accessibility tree and sends touch, key, and button input. The helper’s sources are embedded in the sightmap binary. On first use (device doctor or device start), sightmap builds them with your local Xcode toolchain; Swift Package Manager downloads idb’s frameworks (about 10 MB) during that build. Nothing else needs installing: no Homebrew, no idb or idb_companion. The build takes a minute or two and is cached under ~/Library/Caches/sightmap/device (set SIGHTMAP_DEVICE_CACHE to move it). It rebuilds only when the embedded sources change. To use a helper you built yourself, set SIGHTMAP_DEVICE_HELPER to its path. Sightmap builds the helper locally instead of shipping a prebuilt, signed binary for two reasons:
  • The helper links Apple’s private CoreSimulator and accessibility frameworks through FBSimulatorControl. Those frameworks track the installed Xcode, so a helper built against your Xcode matches it, while a prebuilt binary could break on the next Xcode release.
  • go install, the npm package, and the release binaries stay identical, with no per-platform codesigning or notarization pipeline for a separate helper.
A new Xcode release can still need a sightmap update; device doctor says so when the helper fails to build.

Limits

  • Simulator only, on Apple Silicon. Physical devices are not supported.
  • No hover or file upload. For another screen size, start on a different --device.
  • click confirms the tap was delivered, not that the app handled it. On iOS 26, a screen with a hidden search field and search scopes can have an invisible strip up to ~35 pt below the navigation bar that swallows touches (a real finger’s too), with nothing in the accessibility tree to show it. Check the result with snapshot and, if nothing changed, use tap-xy lower in the target.
  • --probe reads SwiftUI views only, from Apple’s undocumented view debug data.
  • Network capture covers URLSession/CFNetwork traffic (and, for React Native Debug builds, JS traffic through Metro); full detail needs the get-task-allow entitlement.
The sightmap-device agent skill covers the full agent workflow, including React Native specifics. Install it with sightmap skills install.