Reputation: 31
I want to push a View when I tap on an Image. My Code so far:
struct Home: View {
var body: some View {
NavigationView {
VStack {
Image("image")
.onTapGesture {
//navigation code here
}
Text("Tap on image to find details")
}
}
}
}
How to achieve that navigation? Thanks!
Upvotes: 2
Views: 4713
Reputation: 257693
Why can't you use standard NavigationLink as below?
NavigationView {
VStack {
NavigationLink(destination: SomeDestinationViewHere()) {
Image("image")
}
Text("Tap on image to find details")
}
}
Upvotes: 5