3

I have a transparent view on top of another view in a z stack and would like to interact with them both simultaneously. How can I override hit test in swiftui so I can interact with both views in the z stack on top of each other?

I found a way using ui kit but how can I do the same swiftui? How can I click a button behind a transparent UIView?

I tried changing both views zindex to 0 but doesn’t work as one view still cancels the other out. Any thoughts?

// I want both views to be interctable but shows that z layering
ZStack {
    TestView()
    MainView().allowsHitTesting(true) // I still want this view to be interactable
}

enter image description here

Wetthumb
  • 31
  • 3
  • Please provide a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) – nicksarno Feb 14 '21 at 23:09

0 Answers0