Created
March 25, 2023 19:23
-
-
Save andresr-dev/235c8d118394d74c7621f78cf902c910 to your computer and use it in GitHub Desktop.
This is how to force dark mode in your application when the SwiftUI .preferedColorScheme() is not enough
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let scenes = UIApplication.shared.connectedScenes | |
guard let scene = scenes.first as? UIWindowScene else { return } | |
scene.keyWindow?.overrideUserInterfaceStyle = .dark |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment