core/commands/native_tap/ios_simulator_hid library

Classes

IosSimulatorDescribed
The helper read the accessibility tree; json is its stdout, parsed by parseIosSimulatorAccessibility.
IosSimulatorDescribeFailed
This read failed but the next one may work: it timed out, or the helper exited in an unexpected way.
IosSimulatorDescribeOrientationUnknown
The helper could not tell how the simulator is rotated (exit code 5), so it could not map the frames. Usually brief (boot, rotation): retry.
IosSimulatorDescribeResult
Outcome of iosSimulatorDescribe.
IosSimulatorDescribeUnavailable
The accessibility tree cannot be read and retrying won't help: no toolchain, the helper doesn't build, unknown or shut down simulator, a CoreSimulator without the accessibility API (helper exit code 1).
IosSimulatorHidFailed
The touch may have been partially delivered (helper exit code 4, or the helper was killed on timeout). Callers must NOT fall back to another tap path: that could double-tap.
IosSimulatorHidOrientationUnknown
The helper could not tell how the simulator is rotated, so it refused to tap (helper exit code 5). Nothing was delivered, but callers must not fall back either: the point could land on a different spot than intended.
IosSimulatorHidOutOfBounds
The coordinates are outside the simulator screen (helper exit code 3).
IosSimulatorHidResult
Outcome of iosSimulatorHidTap.
IosSimulatorHidTapped
The helper delivered the touch down/up pair.
IosSimulatorHidUnavailable
The HID path could not be used and nothing was delivered; callers should fall back.

Enums

IosSimulatorOrientation
Interface orientation of the simulator's main screen, as the helper reads it from CoreSimulator (SimScreenProperties.uiOrientation). Names follow devicectl device orientation set.

Constants

iosSimulatorDescribeTimeout → const Duration
Default limit for one describe run. The first accessibility query on a freshly booted simulator took up to 7.5 s on an M-series Mac; later ones take about 0.2 s.
iosSimulatorHidCompilerFlags → const List<String>
Flags passed to xcrun swiftc. Part of the cache key.

Functions

extractHidErrorMessage(String stderr) → String?
Message of the last ERROR: line in stderr, without the prefix. Other lines (e.g. objc duplicate-class warnings) are ignored.
fnv1a64Hex(List<int> bytes) → String
FNV-1a 64-bit hash of bytes as 16 lowercase hex digits.
iosSimulatorDescribe({required String udid, Duration timeout = iosSimulatorDescribeTimeout, Map<String, String>? environment, HidProcessRunner? runner, String? cacheDir}) → Future<IosSimulatorDescribeResult>
Reads the accessibility tree of the frontmost application on the booted simulator udid (SpringBoard while a system alert is up). The helper is killed after timeout; compiling it on first use has its own limit.
iosSimulatorHidBinaryPath(String cacheDir, {String source = iosSimulatorHidSource, List<String> flags = iosSimulatorHidCompilerFlags}) → String
Path of the cached helper binary for source compiled with flags inside cacheDir.
iosSimulatorHidCacheDir({Map<String, String>? environment}) → String?
Directory holding compiled helpers: FDB_CACHE_DIR, else HOME/Library/Caches/fdb. Returns null when neither is available.
iosSimulatorHidTap({required String udid, required double x, required double y, Map<String, String>? environment, HidProcessRunner? runner, String? cacheDir}) → Future<IosSimulatorHidResult>
Taps (x, y) in points on the booted simulator udid. The point is in the current interface orientation, like screenshots and fdb tap --at.
iosSimulatorInterfacePoint(IosSimulatorOrientation orientation, {required double x, required double y, required double portraitWidth, required double portraitHeight}) → ({double x, double y})
Rotates (x, y) from the portrait frame back into the current orientation's frame: the inverse of iosSimulatorPortraitPoint.
iosSimulatorOrientedSize(IosSimulatorOrientation orientation, {required double portraitWidth, required double portraitHeight}) → ({double height, double width})
Size of the on-screen frame for a screen that is portraitWidth x portraitHeight points in portrait. Width and height swap in landscape.
iosSimulatorPointInBounds(IosSimulatorOrientation orientation, {required double x, required double y, required double portraitWidth, required double portraitHeight}) → bool
Whether (x, y), in the current orientation's frame, lies on screen.
iosSimulatorPortraitPoint(IosSimulatorOrientation orientation, {required double x, required double y, required double portraitWidth, required double portraitHeight}) → ({double x, double y})
Rotates (x, y) from the current orientation's frame (what screenshots and fdb tap use) into the portrait frame the simulator HID stack expects.
runHidProcess(String executable, List<String> arguments, Duration timeout) → Future<HidProcessOutput>
Default HidProcessRunner: starts the process, decodes output leniently and SIGKILLs it after timeout (then throws TimeoutException).

Typedefs

HidProcessOutput = ({int exitCode, String stderr, String stdout})
Output of a finished process.
HidProcessRunner = Future<HidProcessOutput> Function(String executable, List<String> arguments, Duration timeout)
Runs executable with arguments. Throws TimeoutException after timeout and ProcessException when the executable cannot be started.