Make sure we are changing the user interface style on the main thread

This commit is contained in:
Maurice Parker 2020-07-27 19:35:41 -05:00
parent f2f3ccbe00
commit 66f8180006
1 changed files with 9 additions and 7 deletions

View File

@ -111,13 +111,15 @@ private extension SceneDelegate {
}
func updateUserInterfaceStyle() {
switch AppDefaults.userInterfaceColorPalette {
case .automatic:
window!.overrideUserInterfaceStyle = .unspecified
case .light:
window!.overrideUserInterfaceStyle = .light
case .dark:
window!.overrideUserInterfaceStyle = .dark
DispatchQueue.main.async {
switch AppDefaults.userInterfaceColorPalette {
case .automatic:
self.window!.overrideUserInterfaceStyle = .unspecified
case .light:
self.window!.overrideUserInterfaceStyle = .light
case .dark:
self.window!.overrideUserInterfaceStyle = .dark
}
}
}