I was playing around with SwiftUI and want to be able to come back to the previous view when tapping a button, the same we use popViewController inside a
popViewController
This seems to work for me on watchOS (haven't tried on iOS):
@Environment(\.presentationMode) var presentationMode
And then when you need to pop
self.presentationMode.wrappedValue.dismiss()