I am developing an ios app using swift.I am on xcode 15.3 now
I have a problem with NavigationView
Let’s say my app have 2 pages (page A,page B) and a popover sheet C
I wrapped my whole app with NavigationView().
//Page A
struct ContentView: View {
var body: some View {
NavigationView {
Main()
.navigationBarHidden(true)
}
}
}
From page A I can navigate to page B clicking a button
//Page B
NavigationLink(
destination: LookupFlightPage().navigationBarBackButtonHidden(true),
tag: 1,
selection: $clickItem) {
CategoryItem(icon: "airplane.circle", name: "Flights").onTapGesture {
clickItem = 1
}
}
From page B I can open the popover sheet C
BottomLineControl(label: "From", icon: {
Image(systemName: "airplane")
}, searchText: searchedData.from, onTap: {
popoverOpen1 = true
}).sheet(isPresented: $popoverOpen1, content: {
FlightSearch(popoverOpen: $popoverOpen1, dataChanged: $searchedData.from)
})
And In C, I can cancel the sheet to be back to page B(set binding state popoverOpen1 = false).BUT the problem is when I canceled the sheet C, it brought me to page A.
HStack {
SearchField(searchText: "")
Text("Cancel").font(.system(size: 14.0)).foregroundColor(.white).onTapGesture {
popoverOpen = false
}
}
The problem occurred when I had updated my xcode 12.x to xcode 15.3.Everything was good back in the older version.So I think it might be due to some usage of NavigationView
Thank you
Dang Vu is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.