I'm building a simple project in swiftUI where I have a view that is displayed after I click on a navigation link with this being the result:
As you can see the image sits under the back button, but I would like it to be behind it and take the space of the notch. Still with the back button on it. This was the original code:
List{
ZStack (alignment: .bottom){
Image(drink.imageName)
.resizable()
.aspectRatio(contentMode: .fit)
Rectangle()
.frame(height:80)
.opacity(0.5)
.blur(radius: 10)
HStack{
VStack(alignment: .leading, spacing: 8){
Text(drink.name)
.font(.largeTitle)
.foregroundColor(.white)
}
.padding(.leading)
.padding(.bottom)
Spacer()
}
}
.listRowInsets(EdgeInsets())
VStack (alignment: .leading){
Text(drink.description)
HStack {
Spacer()
Button(action: /*@START_MENU_TOKEN@*/{}/*@END_MENU_TOKEN@*/, label: {
Text("Order it")
})
.frame(width: 150, height:50)
.background(Color.blue)
.foregroundColor(.white)
.font(.headline)
.cornerRadius(10 )
Spacer()
}.padding(.top, 50)
}.padding(.top,15)
}
I tried to add:
.edgesIgnoringSafeArea(.all)
.navigationBarHidden(true)
after the List construct which brought me to this result:
So as you can see the image now is taking the space that was previously occupied by the navbar but it's still leaving white space in the notch zone. Plus because of .navigationBarHidden(true) there is no back button and because of that I can't come back to the original view. I would like to still have the back button but placed on top of the image. Not having the image under it
Thank you so much