I'm having an issue where when I am in a nested navigation view and use a popup view to add a core data object where when I dismiss the view instead of going 1 view back it goes to the root view.
I've tried many ways to dismiss the view. I have tried different ways of calling the popup view including:
Dismissing view:
then
Calling and Dismissing view:
Then in the sheet view:
Then on the save button:
Navigation work but instead of just going back one view it goes back to the root view. This is frustrating especially when you are 5 views in and just want to go back one view.
I've tried many ways to dismiss the view. I have tried different ways of calling the popup view including:
Dismissing view:
Code Block @Environment(\.presentationMode) var presentationModel
then
Code Block self.presentationMode.wrappedValue.dismiss()
Calling and Dismissing view:
Code Block @State var showAddObjectView = false
Code Block .navigationBarItems(trailing: Button(action: { self.showAddObjectView.toggle() }) { Image(systemName: "plus").imageScale(.large).font(Font.system(.body)).padding(15).accentColor(Color("BlackWhite")) }.sheet(isPresented: $showAddObjectView) { AddMoodView(showAddMood: $showAddMood, person: person).environment(\.managedObjectContext, self.managedObjectContext) } )
Then in the sheet view:
Code Block @Binding var showAddObjectView: Bool
Then on the save button:
Code Block self.showAddMood = false
Navigation work but instead of just going back one view it goes back to the root view. This is frustrating especially when you are 5 views in and just want to go back one view.