Complete Technical Guide to Disabling Dark Mode in iOS 13

Nov 23, 2025 · Programming · 10 views · 7.8

Keywords: iOS | Dark Mode | Interface Style

Abstract: This article provides a comprehensive exploration of methods to disable dark mode globally or locally in iOS 13 and later versions, including approaches via Info.plist files, window properties, view controllers, and SwiftUI views. It analyzes the applicable scenarios, implementation steps, and considerations for each method, offering complete code examples and best practices to help developers maintain consistent app interface styling.

Introduction

With the introduction of dark mode in iOS 13, many apps require adaptation to this new feature. However, in certain scenarios, developers may wish to disable dark mode to maintain interface consistency. For instance, when an app includes web views that do not support dark themes, enforcing light mode can prevent stylistic inconsistencies. This article systematically introduces multiple technical solutions for disabling dark mode in iOS 13 and above.

Globally Disabling Dark Mode via Info.plist

In Xcode 12 and later, you can globally set the app's user interface style by modifying the Info.plist file. The specific steps are as follows:

First, add the UIUserInterfaceStyle key to the Info.plist file and set its value to Light. The corresponding XML code is:

<key>UIUserInterfaceStyle</key>
<string>Light</string>

This setting affects the entire app, ensuring all interfaces use light mode. Note that starting from Xcode 13, this setting may be labeled as "Appearance" in the build settings, but the underlying XML structure remains unchanged.

Setting Interface Style via Window Properties

Another method to globally disable dark mode is by setting the overrideUserInterfaceStyle property of the window. This approach is suitable for scenarios where dynamic adjustment of the interface style at runtime is needed. Example code:

if #available(iOS 13.0, *) {
    window?.overrideUserInterfaceStyle = .light
}

This code should be placed in the AppDelegate or SceneDelegate file, depending on how the project was created. Once set, all views within the window will adopt light mode.

Disabling Dark Mode in View Controllers

If you only need to disable dark mode in specific view controllers, override the viewDidLoad method and set the overrideUserInterfaceStyle property. Example code:

override func viewDidLoad() {
    super.viewDidLoad()
    if #available(iOS 13.0, *) {
        overrideUserInterfaceStyle = .light
    }
}

This setting affects not only the current view controller but also its child view controllers. For Objective-C projects, the corresponding code is:

if (@available(iOS 13.0, *)) {
    self.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
}

Setting Color Scheme in SwiftUI Views

For apps built with SwiftUI, you can set the color scheme for specific views using the preferredColorScheme modifier. Example code:

import SwiftUI

struct ContentView: View {
    var body: some View {
        Text("Light Only")
            .preferredColorScheme(.light)
    }
}

This method allows developers to finely control the interface style of each view, making it ideal for complex apps that mix light and dark modes.

Summary and Best Practices

There are multiple methods to disable dark mode, and the choice depends on specific requirements. If you want the entire app to use light mode, it is recommended to set it via the Info.plist file; for dynamic adjustments at runtime, use the window property; for local control, methods in view controllers or SwiftUI views are more appropriate. Regardless of the method chosen, ensure code compatibility, especially in apps supporting multiple iOS versions.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.