Redirecting to a different view

I'm trying to make my app redirect back to the view it came from via a navigation link. I want it to be structured so that after the user presses the button it updates my environment object and then goes back to the view that it initially came from but with updated data.

I've tried using a NavigationView but that only creates a new NavigationView on top of the one that already exists from the previous view. Here's the code:

Code Block
Button(action: {self.stopWatch.stop()}) {
            TimerButton(label: "Stop", buttonColor: Color.red)
          }
          .offset(y:400)
          .padding(.top, 30)

I do not see how the code you show relates to the goal you have…

So may be worth reading this about using environment with NavigationLink.
Hope that helps.

h ttps:// medium. com/@karinprater/how-to-make-navigation-in-swiftui-a-piece-of-cake-223b2a40c6c1
Redirecting to a different view
 
 
Q