Skip to content

Instantly share code, notes, and snippets.

@muhammadabbas001
Created November 19, 2023 17:42
Show Gist options
  • Save muhammadabbas001/c372e27ed7e3cafe5c93e1034be7425b to your computer and use it in GitHub Desktop.
Save muhammadabbas001/c372e27ed7e3cafe5c93e1034be7425b to your computer and use it in GitHub Desktop.
private func onDragEnded(drag: DragGesture.Value) {
let dragThreshold: CGFloat = 200
if drag.predictedEndTranslation.width > dragThreshold || drag.translation.width > dragThreshold {
carousalLocation = carousalLocation - 1
} else if (drag.predictedEndTranslation.width) < (-1 * dragThreshold) || (drag.translation.width) < (-1 * dragThreshold) {
carousalLocation = carousalLocation + 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment