Solution for Dismiss sheet with scrollview when reaching bottom
is Given Below:
My app has a SwiftUI sheet/modal which then contains a long scrollview. From there, pulling down when the user is at the top of the scrollview will dismiss the sheet (default behavior). If a user scrolls to the bottom, I’d love to be able to detect when they are at the bottom and are “pulling up”. The out of the box behavior is that a user can pull up, empty space is added, but as soon as one let’s go it springs back to the bottom of the scrollview. Instead, if a user pulls up here I’d like to start fading the sheet and if they pull up enough and let go ultimately dismiss the sheet. My initial thought was to add a geometry reader to get the height of the sheet and a drag gesture to see the user is dragging while at the bottom, but I haven’t been able to get the drag gesture to work on top of the ScrollView. Is there another obvious solution here that I’m not considering other than that? Any ideas to get the drag gesture sending updates?