Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide the status bar in SwiftUI

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)

    }
like image 572
Alexweng Avatar asked Jul 05 '19 04:07

Alexweng


People also ask

What is the IOS status bar?

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.

Why does SwiftUI use some view?

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.


1 Answers

.edgesIgnoringSafeArea(.all)
.statusBar(hidden: true)

try this

like image 86
Mehmet Ali Vatanlar Avatar answered Sep 30 '22 20:09

Mehmet Ali Vatanlar