Dark mode does not switch to a Dark mode background in Xcode

7.7k Views Asked by At

I have set up different backgrounds for 'Light/Dark Appearance'

enter image description here

But when switching between Light/Dark mode within Xcode, my background always uses image from 'Any/Light Appearance'. Only colours set for icons changes accordingly.

enter image description here

FYI: I'm switching between Light/Dark mode using Interface Style option.

enter image description here

Can someone please advice what I'm missing on? It's all new to me.

9

There are 9 best solutions below

4
Ikhsannul Hijri On BEST ANSWER

I think it is an Xcode bug. You can confirm it by changing your setting in the iOS Simulator.

Go to Settings -> Developer -> Dark Appearance

1
erictruong On

Set your image to Render As Original Image

3
2rahulsk On

I think you might need to uncheck the Resizing checkbox and set the Scales property to Single Scale. It worked for me.

enter image description here

0
XYD On

I think it's an Xcode (latest version) bug.

If you run it on your phone, you won't have this problem. Meaning settings are correct.

0
Sunandan Nandi On

In Simulator it's working fine. One can confirm by toggling the Appearance from feature menu of the simulator.

0
Rhenz On

This seems like an Xcode bug, but when you try to run it on your simulator or physical device, it should work perfectly assuming you are in Dark Mode.

0
Sahil Tah On

By unchecking the Preserve Vector Data option 1, one can see the change in the background when switching between the modes from interface styles 2.

But I noticed that if you leave the option selected and test it on the simulator, it works perfectly fine there. Hence I feel it's an Xcode bug too.

enter image description here

enter image description here

0
Debashish M On

The Xcode Bug is still here, Xcode storyboard appearance switcher does not work, it only works in the simulator.
You can change the simulator device appearance: Settings> Developer> Dark Appearance.


Happy coding.

0
Mobias On

On my physical device iPhone 8 iOS 14.6 dark Mode doesn't work. traitCollectionDidChange not get called after switching to dark mode. On my iPhone 12 iOS 15.x, and some testers it works. No Solution i tried worked. Also i got some other weird UI bugs aswell on my iPhone 8.

Hope its just an Xcode Bug.