Contents

appearance

The interface style of the device.

Declaration

var appearance: XCUIDevice.Appearance { get set }

Discussion

Use this property to get or set the interface appearance the system uses for applications running on the device. The example below captures the initial appearance value and sets the device to Dark Mode:

let previousAppearance = XCUIDevice.shared.appearance 
XCUIDevice.shared.appearance = .dark

Set the property once in your test fixture’s setup or intialization code to set an appearance for all the test methods in that fixture.

See Also

Interacting with the OS