Orchard.Simulator (orchard v0.1.7)
View SourceModule for managing iOS simulators using AXe CLI.
This module provides functions to list, boot, and manage simulators. When a simulator is booted, a SimulatorServer GenServer is started to manage its lifecycle.
Summary
Functions
Boots a simulator.
Starts video capture from the simulator using screenshot-based streaming.
Gets UI hierarchy description from AXe
Erases a simulator's contents and settings.
Finds a simulator by its name or UDID.
Gets the server process for a simulator.
Installs an app on the simulator.
Launches an app on the simulator.
Lists all available simulators.
Lists only booted simulators.
Records video using native simctl recording (file-based only).
Takes a screenshot of the simulator.
Shuts down a simulator.
Records video from the simulator. Returns the PID of the recording process.
Stops video recording.
Stops a video capture or recording process.
UI automation functions using AXe
Uninstalls an app from the simulator.
Types
Functions
Boots a simulator.
Starts video capture from the simulator using screenshot-based streaming.
Note: iOS simulators don't provide real-time video streams. This method captures screenshots at regular intervals and encodes them into a video stream.
Options:
:output
- Output path or streaming URL (default: "/tmp/simulator_<udid>.mp4"):fps
- Frames per second (default: 30):duration
- Maximum duration in seconds (optional)
For true real-time streaming, consider using Facebook's idb tool alongside Orchard.
Examples
iex> {:ok, simulator} = Orchard.Simulator.find_by_name("iPhone 15")
iex> {:ok, stream} = Orchard.Simulator.capture_video(simulator, output: "output.mp4", fps: 30)
iex> Orchard.Simulator.stop_video_capture(stream)
:ok
Gets UI hierarchy description from AXe
Erases a simulator's contents and settings.
Finds a simulator by its name or UDID.
Gets the server process for a simulator.
Installs an app on the simulator.
Launches an app on the simulator.
Lists all available simulators.
Returns a list of simulator structs.
Lists only booted simulators.
Records video using native simctl recording (file-based only).
This uses Apple's built-in recording functionality which provides excellent quality but only supports recording to files, not real-time streaming.
Options:
:codec
- Video codec: "h264" (default) or "hevc":display
- Display to record: "internal" (default) or "external":mask
- Black mask setting: "ignored" (default) or "black":force
- Force overwrite existing file (default: false)
Examples
iex> {:ok, recording} = Orchard.Simulator.record_video(simulator, "recording.mp4")
iex> Process.sleep(5000) # Record for 5 seconds
iex> Orchard.Simulator.stop_recording(recording)
:ok
Takes a screenshot of the simulator.
Shuts down a simulator.
Records video from the simulator. Returns the PID of the recording process.
@spec stop_recording(pid()) :: :ok
Stops video recording.
Stops a video capture or recording process.
UI automation functions using AXe
Uninstalls an app from the simulator.