I am using xcode 13.2.1 iOS 15,i want to hide the navigational bar and the back arrow i have tried several methods. none of the answers worked
var body: some View {
NavigationView{
ZStack{
Text("Header") //Header View
Spacer ()
Text("Main")//Main View
Spacer()
Spacer()
Text("Bottom") //Bottom View
}.navigationTitle("")
.navigationBarHidden(true)
}.navigationViewStyle(.stack)
}
2
Answers
I fixed this on xcode 12.5 by adding this:
and then under info.plist I added
using xml type.
Also I had
.navigationBarHidden(true)
on the upmost level in the view, so for you, the NavigationView.A better SwiftUI approach is to create a @State property to toggle the state.
You switching the value in .onAppear {} to true. When you dismiss the view you call .onDisappear {} and set the property to false.
Now you can use it like so: