I cannot hide NavigationView bar. I tried both variants:
Code 1:
public var body: some View {
NavigationView {
MasterView()
.navigationBarHidden(true)
}
}
Code 2:
public var body: some View {
NavigationView {
MasterView()
}
.navigationBarHidden(true)
}
Does anyone have an idea how to fix it?
Use navigationBarHidden(_:) to hide the navigation bar. This modifier only takes effect when this view is inside of and visible within a NavigationView .
The . navigationBarBackButtonHidden(true) will hide the back button.
NavigationView is one of the most important components of a SwiftUI app, allowing us to push and pop screens with ease, presenting information in a clear, hierarchical way for users.
Seems that the solution could be adding a title or removing the space from safe area.
The problem:

Solution 1:
.navigationBarHidden(true)
.navigationBarTitle(Text("Home"))
Solution 2 (this seems be the best):
.navigationBarHidden(true)
.navigationBarTitle(Text("Home"))
.edgesIgnoringSafeArea([.top, .bottom])

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