I want to hide the status bar in SwiftUI. I have try the method "statusBar(hidden: true)", but it doesn't work. Is there any solution to make it in SwiftUI.
the demo code as below:
var body: some View {
VStack {
Text("Hello World")
}
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.background(Color.blue)
.edgesIgnoringSafeArea(.all)
.statusBar(hidden: true)
}
A status bar appears along the upper edge of the screen and displays information about the device's current state, like the time, cellular carrier, and battery level.
First, using some View is important for performance: SwiftUI needs to be able to look at the views we are showing and understand how they change, so it can correctly update the user interface.
.edgesIgnoringSafeArea(.all)
.statusBar(hidden: true)
try this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With