Last active
December 11, 2020 22:49
-
-
Save artemnovichkov/64f69746d0d302ab725ea63c31914a6d to your computer and use it in GitHub Desktop.
Updating application with new user interface style
This file contains 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
import UIKit | |
public extension UIApplication { | |
func override(_ userInterfaceStyle: UIUserInterfaceStyle) { | |
if supportsMultipleScenes { | |
for connectedScene in connectedScenes { | |
if let scene = connectedScene as? UIWindowScene { | |
for window in scene.windows { | |
window.overrideUserInterfaceStyle = userInterfaceStyle | |
} | |
} | |
} | |
} | |
else { | |
for window in windows { | |
window.overrideUserInterfaceStyle = userInterfaceStyle | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment