How to disable Dark Mode in iOS?

Imad Ali Mohammad
2 min readJan 10, 2022

To disable the dark mode in iOS — Since iOS 13 and later (Xcode 11 or later)

Every app has dark mode enabled by default. But, if you are not ready to adopt it, you can disable it.

There is two way of doing it.

  1. Disable dark mode in the entire app
  2. Disable dark mode in the particular screens or view controllers

Let’s discuss those in detail.

Disable dark mode in the entire app

To control an interface style for an entire app, just simply set UIUserInterfaceStyle (Appearance) key in your Info.plist file.

You can assign it to either Light or Dark value to force a light and dark user interface style.

<key>UIUserInterfaceStyle</key>
<string>Light</string>
Light Mode of the app — Info.plist file

Set Appearance (UIUserInterfaceStyle) key to Light will disable dark mode for an entire app.

Disable dark mode in the particular screens or view controllers

You can also disable dark mode in both UIView and UIViewController.

# UIView

UIView got overrideUserInterfaceStyle property to control an interface style. When you assign a value to a view overrideUserInterfaceStyle property, the style applies to the view and all of the subviews owned by the same view controller.

view.overrideUserInterfaceStyle = .light

# UIViewController

Just like views, view controllers also get the overrideUserInterfaceStyle property. If you assign a value to a view controller overrideUserInterfaceStyle property, the new style applies to the view controller, its entire view hierarchy, and any embedded child view controllers.

override func viewDidLoad() {
super.viewDidLoad()

overrideUserInterfaceStyle = .light
}

So, if you want to disable dark mode for an entire view controller, you better set overrideUserInterfaceStyle on a view controller.

TIP:- iOS Simulator can toggle between light and dark mode with

⌘ — command + ⇧ — shift + A shortcut.

--

--

Imad Ali Mohammad

Senior iOS Engineer, Passionate about coding and building amazing apps.