I'm trying to implement a feature to an app I'm working on so that when a user taps a tab twice, it will automatically send the user back to the tab's initial view.
Suppose that I want the following "Devices" tab button to reload the view on a double tap:
This is the code I've been trying to use to solve this issue:
Tab View {
DevicesScreen()
.tabItem {
Image(systemName: "tv")
Text("Devices")
}.onTapGesture(count: 2) {
DevicesScreen()
}
}.font(.headline)
However, the result of the onTapGesture won't switch the view, therefore I wanted to ask whether there is another solution to the problem.
Thanks in advance.