What is the correct way to pass touches through a view to those below it?

Viewed 698

I have a SwiftUI view that is displayed over other views, and have found that using Color.clear like this below seems to allow touch interactions to pass through to anything under it:

var body: some View {
    VStack {
        Spacer()
        HStack {
            Spacer()
            SomeCustomContent()
            Spacer()
        }
        .overlay(GeometryReader { proxy in
            Color.clear.preference(key: MyCustomHeightPreferenceKey.self, value: proxy.size.height)
        })
    }
}

Is this the correct way to make touches pass through to the views below, or it this just a coincidental quirk/bug in SwiftUI behaviour that Apple might fix/change as swiftui matures?

If not, what is the correct way to pass the touches through?

1 Answers
Related