When I navigate backward (like swiping the view from the left), I want to be able to swipe it back from the right to move to that previous view. Sort of like an undo stack.
Is it possible to use NavigationStack
or other existing views to solve that?
It doesn't come for free, but you can implement this kind of functionality quite easily by saving the last navigation target and handling drag gestures. Like this:
If the navigation hierarchy extends to more than one level then you might need to save more than one previous target, perhaps as a shadow stack.