I want to run unit tests on my CI in the simulator when it is set to dark mode. Is there an option for 'xcodebuild' or 'simctl' to put the simulator in dark mode?
Or do I have to file a radar?
I want to run unit tests on my CI in the simulator when it is set to dark mode. Is there an option for 'xcodebuild' or 'simctl' to put the simulator in dark mode?
Or do I have to file a radar?
You can use xcrun for this:
xcrun simctl ui booted appearance dark
xcrun simctl ui booted appearance light
You can also use the keyboard shortcut Command-Shift-A
I have installed the beta version of Xcode 14 and the toggle appearance function is broken, I can't change the appearance by using Command-Shift-A
nor xcrun simctl ui
.
Is there any way to code it into build settings in Xcode?
I have the same request
As an alternative, could you pass a command line argument or set an environment variable which your app delegate could detect and then set overrideUserInterfaceStyle on its window to force dark mode?
Yes, it is available in Settings > Developer. Look for Dark Apperance at the top of the screen.
More details:
You can use xcrun for this:
xcrun simctl ui booted appearance dark
xcrun simctl ui booted appearance light
You can also use the keyboard shortcut Command-Shift-A
I have installed the beta version of Xcode 14 and the toggle appearance function is broken, I can't change the appearance by using Command-Shift-A
nor xcrun simctl ui
.
Is there any way to code it into build settings in Xcode?