faberNovel / DynamicOverlay

A SwiftUI library that makes easier to develop overlay based interfaces, such as the one presented in the Apple Maps app.
MIT License
210 stars 20 forks source link

Pan gestures do not respond #2

Closed gaetanzanella closed 3 years ago

gaetanzanella commented 3 years ago
struct ContentView: View {

    var body: some View {
            List { // does not scroll
                Text("Ahaha")
            }
            .dynamicOverlay(Color.green)
    }
}
maggnus commented 3 years ago

How to fix?

matthewcheok commented 3 years ago

It looks like touches are getting eaten by this view _TtGC7SwiftUI16PlatformViewHostGVS_42PlatformViewControllerRepresentableAdaptorV14DynamicOverlay38OverlayContainerRepresentableAdaptator__. It looks like a view generated by SwiftUI.

matthewcheok commented 3 years ago

I think this is a view that's automatically created because OverlayContainerRepresentableAdaptator is UIViewControllerRepresentable and it might be challenging to have it passthrough touch events. The only solution I can think of is creating a container view controller in UIKit that composes both the overlay and the background content (to avoid this issue) and wrap in a SwiftUI view using UIViewControllerRepresentable.