Skip to content

Use IDB for simulator screenshots instead of xcrun simctl #26

@obj-p

Description

@obj-p

Summary

Currently SimulatorManager.screenshot() shells out to xcrun simctl io <udid> screenshot to capture simulator screenshots. We should consider using IDB (iOS Development Bridge) instead for tighter integration and better reliability.

Motivation

  • xcrun simctl screenshot runs as a separate process with pipe-based I/O, which has historically been prone to deadlock when stderr output exceeds the pipe buffer (~64KB)
  • IDB provides a more direct programmatic interface to simulator services
  • Tighter integration could reduce latency for screenshot capture, which matters for hot-reload feedback loops

Current implementation

SimulatorManager.screenshot() in Sources/PreviewsIOS/SimulatorManager.swift uses runAsync("/usr/bin/xcrun", arguments: ["simctl", "io", udid, "screenshot", ...]).

Proposed approach

Investigate using IDB's screenshot API (either via the IDB companion daemon or direct framework access) as a replacement for the simctl subprocess approach. This would align with how we already use CoreSimulator.framework directly for device management via SimulatorBridge.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions