ios – SwiftUI : ScrollView touch ended

0
98

[ad_1]

I am looking for a way to know when user has stopped touching a ScrollView. It is not a simple tap (with a TapGesture). It is when user releases his finger after scrolling.

I’ve tried to add a DragGesture but only .onChanged() is triggered, not .onEnded().

ScrollView {
   /* Text Views in a VStack */
}
.gesture(DragGesture()
    .onChanged() { _ in
        print("OnChanged")
    }
    .onEnded() { _ in
        print("OnEnded") // <- Never called
    })

Maybe it could be also when ScrollView did stop scrolling. But I don’t find a way neither. In UIKit there is delegate method called scrollViewDidScroll but not in SwiftUI.

[ad_2]