12

I read Apple Article for disable Dark Mode because I need disable for my all UIViewController and i haven't any BaseUIViewController.

How can I disable Dark Mode for all UIViewController without using any BaseUIViewController? I don't want to write the following code over and over again.

Is there a solution to this?

override func viewDidLoad() {
    super.viewDidLoad()

    // Always adopt a light interface style.    
    overrideUserInterfaceStyle = .light
}
peterh
  • 11,875
  • 18
  • 85
  • 108
Mehmet Salih Aslan
  • 241
  • 1
  • 2
  • 10
  • 1
    @Fogmeister for instance to allow incremental implementation of dark mode support. If you force your app to use light mode, you can release your app with partial support to dark mode without users seeing a flawed UX. – Dávid Pásztor Jun 28 '19 at 09:21
  • 1
    All screen haven't support dark mode. I need to spend time for support dark mode and i don't have much time. @fogmeister – Mehmet Salih Aslan Jun 28 '19 at 09:29

1 Answers1

21

You can force light/dark mode in your whole application regardless of the user's settings by adding the key UIUserInterfaceStyle to your Info.plist file and setting its value to either Light or Dark.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116