I want the code to work when I tap on the NavigationLink displayed in the List.
Look at this code. When I tap on Text("Favorite"), the code moves.
But when I tap the List, code doesn't work.
I set onTapesture on NavigationLink itself, but that didn't solve the problem
How can we fix this?
var body: some View {
NavigationView{
List{
NavigationLink(destination: DeliveryServiceList().environmentObject(self.userData)){
Text("Favorite")
}.onTapGesture {
self.userData.showFavoritesOnly.toggle()
}
}.navigationBarTitle(Text("Services"))
}
}