Disable Dark Mode for iOS, iPadOS and macOS Catalyst App using Swift Programming Language

I want to disable Dark Mode system wide.

Apple Developer has mentioned that you can add 'UIUserInterfaceStyle' key to info.plist. But I checked there is no such key in list and it also gives error when you upload app to the App Store.

I tried using below code in AppDelegate.swift file.

window?.overrideUserInterfaceStyle = .light'

But it seems above code doesn't apply to LaunchScreen.storyboard

How to fix this?

That is LaunchScreen should also obey command to disable dark mode system wide.

Replies

Apple Developer has mentioned that you can add 'UIUserInterfaceStyle' key to info.plist. But I checked there is no such key in list and it also gives error when you upload app to the App Store.

What value have you set? Light? Some articles say it needs to be capitalized, not light.
When I try typing UIUserInterfaceStyle it doesn't get autocompleted...

When I enter it, It itself automatically switches to key called 'Appearance' somehow and then Appearance doesn't have Light / Dark or anything...

I even read Apple Documentation it mentions UIUserInterfaceStyle but When I enter it is info.plist it doesn't get accepted...
  • Just fill the string key with the Appearance as "Light" or "Dark"

Add a Comment

When I enter it, It itself automatically switches to key called 'Appearance'

When the raw key UIUserInterfaceStyle is shown as Appearance in human readable mode, that means UIUserInterfaceStyle is (at least, once was) the supported key.

Appearance doesn't have Light / Dark or anything...

For many values taking String value, the value would not be shown automatically.

When I enter it is info.plist it doesn't get accepted...

You have not clarified what you have entered on what key...

You have not clarified what you have entered on what key...

I have entered 'UIUserInterfaceStyle' as a key but it automatically replaced by 'Appearance'...

Please explain what should I do now...

I have entered 'UIUserInterfaceStyle' as a key but it automatically replaced by 'Appearance'...

It is not a problem, it actually is held as UIUserInterfaceStyle internally.
If you want to see the raw key, choose Raw Keys & Values on the context menu shown in the editor of Info.plist.

If you are sure you set Light there and it causes error on archiving, or it has no effect for LaunchScreen.storyboard,
please share your experience.

If you are sure you set Light there and it causes error on archiving, or it has no effect for LaunchScreen.storyboard,
please share your experience.

I used 'Light' as value for 'Appearance' key...
  1. I was able to validate archive successfully

  2. Setting value 'Light' doesn't affected LaunchScreen... Launch Screen was changing appearance and status bar style with dark mode...