Posts

Post not yet marked as solved
7 Replies
5.8k Views
It’s great to see the new ScrollViewReader and scrollTo functionality. However there still doesn’t seem to be a way to detect when the user stops scrolling, to adjust the final scroll offset so that you can “snap” the scroll view to specific locations. This is such a common requirement in picker-style UIs as well as other use cases where you need items in the scroll view to align with something else on screen, just like we have always been able to do with e.g. UIScrollViewDelegate.scrollViewWillEndDragging Is there a way do to this with SwiftUI in iOS/iPad 14 and macOS 11? If not is there any way this can be added during the betas? It will be extremely painful for us to not have this in SwiftUI for at least another full year. We’re trying to make ship some SwiftUI-“only” apps that need this and there do not appear to be viable workarounds (you can try to fake it without ScrollView, using a custom drag gesture and adjusting contentOffset etc. but it is super painful and does not feel natural, performance issues etc.) Can we get access to the internal isDecelerating state so we can observe it can then call the new scrollTo? Something like: ScrollViewReader { _ in ... } .onEndDragging { scrollProxy in ... } Thanks in advance. Happy to try to book a lab session if that helps. (Resubmitted with correct tag because tags cannot be edited)
Posted
by pygmypony.
Last updated
.