I want to have a dark mode option within the settings page of my Xcode swift app. Is it possible to change dark mode just for the app, on all view controllers in the app? I have my dark colors selected in Assets.xcassets
I understand that I can use overrideUserInterfaceStyle = .dark
but this only changes the one viewController. I want it to switch the entire app.
You could set it on your app's window (it is also a view):
window.overrideUserInterfaceStyle = .dark
Edit: Add to SceneDelegate file in the willConnectTo func
For example:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
window?.overrideUserInterfaceStyle = .light
}