simctl

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMedia

func AddMedia(ctx context.Context, udid, path string) error

AddMedia adds photo/video files to the simulator's library.

func Boot

func Boot(ctx context.Context, udid string) error

Boot starts a simulator by UDID.

func GetAppContainer

func GetAppContainer(ctx context.Context, udid, bundleID, containerType string) (string, error)

GetAppContainer gets the path to an app's container. containerType: "app", "data", "groups", "sile"

func GetAppLogs

func GetAppLogs(ctx context.Context, udid, query, duration string) (string, error)

GetAppLogs captures recent logs for a process or subsystem udid: target simulator query: can be a bundle ID or process name. We'll search both predicate `process like "query" OR subsystem == "query"` duration: parsed duration string (e.g. "5m") for `log show --last`

func GetOrientation

func GetOrientation(ctx context.Context, udid string) (string, error)

GetOrientation returns the device orientation (portrait/landscape) by inspecting screenshot dimensions.

func InstallApp

func InstallApp(ctx context.Context, udid, appPath string) error

InstallApp installs an .app bundle to a simulator.

func Launch

func Launch(_ context.Context, udid, bundleID string) error

Launch starts an app on a simulator by bundle ID.

func LaunchApp

func LaunchApp(ctx context.Context, udid, bundleID string, _ []string) error

LaunchApp is a wrapper around Launch to match the devicectl interface. It accepts optional arguments which are currently ignored for simctl basic launch.

func ListActiveRecordings

func ListActiveRecordings() []string

ListActiveRecordings returns all active recording IDs.

func ListApps

func ListApps(ctx context.Context, udid string) (string, error)

ListApps lists installed applications for a device

func ListRunningApps

func ListRunningApps(ctx context.Context, udid string) ([]string, error)

ListRunningApps lists running applications (processes ending in .app matching heuristic) Returns a list of application names (executable filenames)

func OpenURL

func OpenURL(ctx context.Context, udid, url string) error

OpenURL opens a URL on the simulator.

func Screenshot

func Screenshot(ctx context.Context, udid, outputPath, format string) error

Screenshot captures a screenshot from the simulator.

func SetAppearance

func SetAppearance(ctx context.Context, udid, appearance string) error

SetAppearance sets the simulator appearance (light/dark).

func SetLocation

func SetLocation(ctx context.Context, udid string, lat, lon float64) error

SetLocation sets the simulated location for a device.

func SetPrivacy

func SetPrivacy(ctx context.Context, udid, action, service, bundleID string) error

SetPrivacy grants or revokes permissions. action: "grant", "revoke", "reset" service: "all", "calendar", "contacts", "location", "location-always", "photos", etc. bundleID: target app

func Shutdown

func Shutdown(ctx context.Context, udid string) error

Shutdown stops a simulator by UDID.

func StartVideoRecording

func StartVideoRecording(ctx context.Context, udid, outputPath, codec string) (string, error)

StartVideoRecording starts recording video from a simulator. Returns a recording ID that can be used to stop the recording.

func StopVideoRecording

func StopVideoRecording(id string) (string, error)

StopVideoRecording stops an active recording and returns the output file path.

func Terminate

func Terminate(ctx context.Context, udid, bundleID string) error

Terminate stops an app on a simulator by bundle ID.

func TriggerSimulatorAction

func TriggerSimulatorAction(action string) error

TriggerSimulatorAction triggers a hardware action via AppleScript. Supports: "home", "lock", "volume_up", "volume_down", "biometry_match", "biometry_fail"

func UninstallApp

func UninstallApp(ctx context.Context, udid, bundleID string) error

UninstallApp uninstalls an application by bundle ID.

Types

type Simulator

type Simulator struct {
	UDID    string `json:"udid"`
	Name    string `json:"name"`
	State   State  `json:"state"`
	Runtime string `json:"-"` // Populated manually from runtime map
	// simctl json has "devices" map where key is runtime string.
	IsAvailable bool `json:"isAvailable"`
}

func List

func List(ctx context.Context) ([]Simulator, error)

List returns all available simulators.

type State

type State string
const (
	StateBooted   State = "Booted"
	StateShutdown State = "Shutdown"
)

type VideoRecording

type VideoRecording struct {
	ID       string
	UDID     string
	FilePath string
	Cmd      *exec.Cmd
}

VideoRecording represents an active video recording process.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL