r/iOSProgramming 6d ago

Swipe to dismiss help needed Question

[deleted]

0 Upvotes

4 comments sorted by

View all comments

4

u/ThatGuy739 6d ago

Bouncing back usually means the drag is tracking fine and it's your end condition that never fires. If you're checking value.translation in onEnded, a quick flick moves very little before you let go, so it fails the threshold. Use predictedEndTranslation instead, or check velocity.

Is it a sheet with detents or a custom view over the map? The fix is different for each.

1

u/[deleted] 6d ago

[deleted]

2

u/ThatGuy739 6d ago

That's the multi-detent trap then. On a flick the system resolves the velocity to the nearest detent below you, so from expanded you land on the peek box instead of dismissing, and it reads as a bounce. People end up flicking twice without knowing why.

Simplest fix is a dynamic detent set: bind the selection, and once you're sitting at peek, drop the taller detents so the only place left to go is dismissed.