My navigation link looks like this
struct ContentView: View {
var body: some View {
NavigationView {
GeometryReader { geometryProxy in
NavigationLink {
EmptyView() // Any view
}
label: {
TestView(geometryProxy: geometryProxy)
.buttonStyle(.plain)
.padding(.leading, 8)
}
.buttonStyle(.plain)
.padding(.leading, 0)
}
}
}
}
And my test view looks like this
struct TestView: View {
var geometryProxy: GeometryProxy
var body: some View {
HStack {
Text("Some text here extra space on right")
.frame(maxWidth: geometryProxy.size.width * 0.85, alignment: .leading)
HStack {
Text("9.4")
.lineLimit(2)
.padding(8)
}
.frame(maxWidth: geometryProxy.size.width * 0.15)
.padding([.top, .bottom], 4)
}
}
}
Because there is some gap between the text "Some text here extra space on right" and "9.4", when that area gets tapped nothing happens. NavigationLink will only work when any text is tapped. Why is that?
What is lacking here that will make any view in the TestView cllickable, including empty space.
You may have a look at this: https://stackoverflow.com/questions/57191013/swiftui-cant-tap-in-spacer-of-hstack