struct ContentView: View {
@State var num = 0
var body: some View {
VStack {
NavigationStack {
NavigationLink(destination: {
Text("Number: (num)")
}, label: {
Text("tap here").onTapGesture {
num += 1
print("(num)")
}
})
}
}
}
}
In this code when i tap on the ‘tap here’ NavigationLink it is not navigating to a new page, it get stuck in onTapGesture and just incrementing the value on tap.
Is there is any way to use the NavigationLink for both navigation and action?