Hi! Is there any way in swiftui that I can detect ...
# ios
k
Hi! Is there any way in swiftui that I can detect when user navigates back from a screen using swipe to back gesture? I can use the
onDisappear
modifier but it execute even when I go forward from the screen, I just wanna detect when user goes back from the screen.
a
In case you want to handle only swipe back gesture (but not all pop actions), seems it's impossible without handling in on UIKit level, like creating your own NavigationControllerDelegate. However, if you want to handle the case when your screen re-appears, you can add
onAppear
handle action of your root view and ignore the first call.