fatbobman/Infinite4Pager

ScrollView inside a PageView

Opened this issue · 2 comments

Hey,

The issue I'm facing is that I'm trying to page views with a scroll view inside them. The paging works great but the scroll views do not work. I've tried disabling vertical pages with no luck. Not sure what seems to be the problem. DragGesture overtaking scroll view events? Something with overlays? I'm happy to try to fix it if you point me in the right direction

Jakub

@jakubwarchol In SwiftUI, the built-in scrolling gesture of ScrollView has a higher priority than the native gestures provided by SwiftUI. As a result, when adding a drag gesture to ScrollView using simultaneousGesture (the current approach), it may not work properly due to priority conflicts. Before iOS 18, there was no good solution to this issue. However, iOS 18 introduced UIGestureRecognizer, which offers better compatibility with ScrollView. This might be a potential solution.
https://fatbobman.com/en/posts/swiftuigesture/#integrating-uikit-gestures-in-swiftui