Documentation
¶
Overview ¶
Package simctl is a thin read-only wrapper over `xcrun simctl` for discovering the iOS simulators installed on this machine. It does not boot, install, or otherwise mutate devices — allocation is simbroker's job; provisioning is the consumer's. The one mutation simctl exposes (Boot) is opt-in and used only when a caller passes `claim --boot`.
Index ¶
Constants ¶
const DefaultTimeout = 20 * time.Second
DefaultTimeout bounds a single `xcrun simctl list` so simulator discovery can't hang a command if CoreSimulator wedges. Applied by ListAvailable.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to simctl. The zero value is NOT ready — use New.
func NewWithRunner ¶
NewWithRunner returns a Client backed by a custom Runner (tests).
func (*Client) Boot ¶
Boot boots a device if it isn't already up. Idempotent: an "Unable to boot ... current state: Booted" is treated as success. Best-effort and only used for `claim --boot`; allocation never depends on it.
func (*Client) ListAvailable ¶
ListAvailable returns every available iOS simulator as a class-neutral device.Device — the vocabulary the broker speaks. It maps simctl's rich internal type down (ID := UDID, OS "iOS", Version "major.minor.patch") while preserving the (name, newest-version-first) ordering established by list.
type Device ¶
type Device struct {
UDID string `json:"udid"`
Name string `json:"name"` // e.g. "iPhone 17 Pro"
Runtime string `json:"runtime"` // raw runtime id, e.g. com.apple.CoreSimulator.SimRuntime.iOS-26-4
OS string `json:"os"` // "iOS"
Version Version `json:"version"` // parsed from the runtime id, e.g. {26,4}
State string `json:"state"` // "Booted" | "Shutdown" | "Booting" | ...
TypeID string `json:"deviceType"` // deviceTypeIdentifier
IsAvailable bool `json:"isAvailable"`
}
Device is one installed simulator, flattened from simctl's per-runtime map.
type Runner ¶
Runner runs an argv and returns combined stdout. Swapped out in tests so the package can be exercised without a Mac / Xcode.