SwiftUI App change Status Bar color for single view

The main view of my application is dark and full screen, so I need a status bar that is always white for this screen (rather than white or black depending on dark mode set by the user).

I can apply .preferredColorScheme(.dark) to this mainContent view but in doing so, any views that are presented from this view are also forced to be in dark mode. Is it possible to force the dark mode status bar for the mainContent, but then allow for the content presented via the sheet to use whatever mode the user has set?

@main
struct statusbarApp: App {
    @State var showSheet: Bool = false

    @ViewBuilder
    var mainContent: some View {
        VStack {
            Button("Show Sheet") {
                showSheet.toggle()
            }
            .frame(maxWidth: .infinity)

            Spacer()
        }
        .foregroundColor(.white)
        // .preferredColorScheme(.dark) // <- This applies to all views.
        .background(Color.black, ignoresSafeAreaEdges: .all)
    }

    var body: some Scene {
        WindowGroup {
            mainContent
                .sheet(isPresented: $showSheet) {
                    Text("Dark or Light mode")
                }
        }
    }
}

Yas, it's not possible using swiftUI, try with UIKit.

SwiftUI App change Status Bar color for single view
 
 
Q