iOS Simulator: Set Environment
ios_simulator_set_environmentStage simulator UI state for screenshots or tests: dark mode, Dynamic Type, contrast, frozen status bar, simulated location, app permissions. Clear overrides afterward to prevent polluting later captures.
Instructions
Stage the simulator before a screenshot or a test: dark mode, Dynamic Type size, increased contrast, a frozen status bar, a simulated location, and app permissions. None of this is possible on a physical device, and it is most of the reason to prefer a simulator for UI work. Every field is optional; those given are applied in order and the result reports the state afterwards. A status bar override survives a reboot, so clear it when you are done or it quietly pollutes later screenshots.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| device | No | Which simulator: its UDID or its name as shown by ios_simulator_list. Omit it when exactly one is booted — that is the normal case, and IOS_SIMULATOR_ID pins it when it is not. Unlike simctl's own `booted`, this never picks arbitrarily between two. | |
| location | No | Teleport the device, for location-gated screens. | |
| appearance | No | Interface style. | |
| permission | No | Set an app permission directly. This is how you reach the denied branch of a permission check, which is otherwise a prompt nobody can tap. | |
| status_bar | No | Freeze the status bar. Overrides persist until cleared. | |
| content_size | No | Dynamic Type size. The accessibility- sizes are where layouts break. | |
| clear_location | No | Stop simulating a location. | |
| clear_status_bar | No | Drop every status bar override, restoring the real one. | |
| increase_contrast | No | Increase Contrast accessibility mode. |