Skip to content

Commit

Permalink
override overrideUserInterfaceStyle (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinneko authored Jun 18, 2024
1 parent 5f670ca commit fd813f4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ struct CharcoalFullScreenCoverViewModifier<SubContent: View>: ViewModifier {
if newValue {
hostingViewController = UIHostingController(rootView: subContent())

if let hostingViewController {
if let hostingViewController, let rootViewController = windowScene.windows.filter({ $0.isKeyWindow }).first?.rootViewController {
hostingViewController.overrideUserInterfaceStyle = rootViewController.traitCollection.userInterfaceStyle
hostingViewController.view.backgroundColor = UIColor.clear
hostingViewController.modalPresentationStyle = .overFullScreen
windowScene.windows.filter { $0.isKeyWindow }.first?.rootViewController?.present(hostingViewController, animated: false)
rootViewController.present(hostingViewController, animated: false)
}
} else {
Task {
Expand Down

0 comments on commit fd813f4

Please sign in to comment.