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.
Summary
Currently
SimulatorManager.screenshot()shells out toxcrun simctl io <udid> screenshotto capture simulator screenshots. We should consider using IDB (iOS Development Bridge) instead for tighter integration and better reliability.Motivation
xcrun simctl screenshotruns as a separate process with pipe-based I/O, which has historically been prone to deadlock when stderr output exceeds the pipe buffer (~64KB)Current implementation
SimulatorManager.screenshot()inSources/PreviewsIOS/SimulatorManager.swiftusesrunAsync("/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.