I am drawing boxes and I would like to tap on them. However, Tap gesture does not work if I put code inside ScrollView. If I remove GeometryReaer the code works, however I need it (although I do not use it in this simple example). Any ideas how to make code work with ScrollView and GeometryReader?
struct ContentView: View {
var body: some View {
// REMOVING ScrollView makes TapGesture WORK
ScrollView {
WorksGridView()
}
}
}
struct WorksGridView: View {
private var items = 5
var body: some View {
GeometryReader { geometry in
VStack(spacing: 0) {
ForEach(0..<self.items) { index in
GridInventoryItem()
.onTapGesture {
print("I'm not appearing!!!")
}
}
}
}
}
}
struct GridInventoryItem: View {
var body: some View {
Rectangle()
.padding()
.frame(width: 150, height: 150)
}
}
