PLATFORM AND VERSION iOS Development environment: Xcode 16, macOS 15.0.1 Run-time configuration: iOS 18.1
DESCRIPTION OF THE PROBLEM I am experiencing inconsistent behaviour in SwiftUI when attempting to hide the status bar programmatically. Specifically, I want the status bar to be hidden only during the AreaQuizView, but the behaviour is not persistent across different views. On some views, the status bar hides correctly, while on others, it does not. I am using .statusBarHidden() to achieve this.
STEPS TO REPRODUCE
In AreasView, apply .statusBarHidden() to the outermost VStack. The status bar hides as expected.
In AreaQuizView, apply the same .statusBarHidden() to the outermost stack. However, in this view, the status bar remains visible.
In the Build Targets, if I set Status bar is initially hidden to YES in the info.plist, I lose control over the status bar entirely.
EXPECTED BEHAVIOUR I would expect that .statusBarHidden() would behave consistently across all views, allowing me to programmatically hide the status bar only during AreaQuizView and leave it visible for other views.
ADVICE REQUESTED Could you please advise on how to achieve the desired behaviour, where the status bar is only hidden during AreaQuizView? I would also appreciate any guidance on ensuring consistent behaviour across different views.
Please advise.