A large part of my app consists of web views to provide functionality not yet available through native implementations. The web team has no plans to implement a dark theme for the website. As such, my app will look a bit half/half with Dark Mode support on iOS 13.
Is it possible to opt out of Dark Mode support such that our app always shows light mode to match the website theme?
You can off dark mode in entire application xcode 11 or more
Add bellow like
Info.plist will be look like bellow..
Just simply add following key in your
info.plist
file :If you are not using Xcode 11 or later (i,e iOS 13 or later SDK), your app has not automatically opted to support dark mode. So, there's no need to opt out of dark mode.
If you are using Xcode 11 or later, the system has automatically enabled dark mode for your app. There are two approaches to disable dark mode depending on your preference. You can disable it entirely or disable it for any specific window, view, or view controller.
Disable Dark Mode Entirely for your App
You can disable dark mode by including the
UIUserInterfaceStyle
key with a value asLight
in your app’s Info.plist file.This ignores the user's preference and always applies a light appearance to your app.
Disable dark mode for Window, View, or View Controller
You can force your interface to always appear in a light or dark style by setting the
overrideUserInterfaceStyle
property of the appropriate window, view, or view controller.View controllers:
Views:
Window:
Read more here: Choosing a Specific Interface Style for Your iOS App
- For entire App (Window):
You can get the window from
SceneDelegate
- For a single ViewController:
You can set any
viewController
, even inside the viewController itself- For a single View:
You can set any
view
, even inside the view itselfYou may need to use
if #available(iOS 13.0, *) { ,,, }
if you are supporting earlier iOS versions.Apart from other responses, from my understanding of the following, you only need to prepare for Dark mode when compiling against iOS 13 SDK (using XCode 11).
Link
Latest Update-
If you're using Xcode 10.x, then the default
UIUserInterfaceStyle
islight
for iOS 13.x. When run on an iOS 13 device, it will work in Light Mode only.No need to explicitly add the
UIUserInterfaceStyle
key in Info.plist file, adding it will give an error when you Validate your app, saying:Only add the
UIUserInterfaceStyle
key in Info.plist file when using Xcode 11.x.