Disable “Dark Mode” in iOS 13 for your iOS App

iOS 13 is released for public and with that Xcode 1 1 is also released for developers..
iOS 13 has many great features and improvements, and some new features, i like two of them one is Card View like presentation of ViewController..and Dark mode which i like the most..
You would love to see the dark mode in action if the app supports dark mode(Developer has adapted new guidelines and given support for Dark Mode), but if not, then it will mess the complete UI.
What if you want to give support to your app for iOS 13 Dark Mode..??
You have to go through the documentation and adapt new guidelines, but it will take some time and you dont want the user to have that messy and Dark distorted user experience.
you can go through this documentation from apple to adapt Dark Mode
click here
Note: -
By default all instances of
UIViewController
are set to automatically adapt their color appearance to match the user’s system preferences, but if you want you can force some or all of your app to use light or dark mode by setting theoverrideUserInterfaceStyle
property of your view controller to.light
or.dark
.
Here are few tips and tricks which you can use in your app to support or bypass the dark mode..
#First tip: To override the ViewController style
you can override the interface style of UIViewController by 1: overrideUserInterfaceStyle = .dark //For dark mode
2: overrideUserInterfaceStyle = .light //For light mode
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
overrideUserInterfaceStyle = .light
}
}
#Second tip: Adding a key in info.plist
Simply you can add a new key UIUserInterfaceStyle
in your app info.plist
and set its value to Light
or Dark
. this will override the app default style to the value you provide.
You dont have to add overrideUserInterfaceStyle = .light this line in every viewController, just one line in info.plist that’s it.