SwiftUI gesture and motion modifiers
Gesture modifiers with real physics you attach to your own views, starting with drag to dismiss for photos, cards and sheets.
About these pieces
One self-contained Swift file each, Apple frameworks only, from iOS 17.
Drag to Dismiss is a modifier that lets a photo, card or sheet follow a two-axis drag, rounds and shrinks it with progress over a scrim, reports its phase so your UI can say release to close, then springs back or flies off along the drag vector past a distance or velocity threshold.
For more motion across the library, see the animations collection: card stacks, flips, carousels, text reveals, number rolls and state morphs.
Learn the technique: SwiftUI motion guide, SwiftUI animations guide.
Questions
How the pieces work, and how to build the same thing yourself. Every piece's page has its full notes.
How do I add drag to dismiss in SwiftUI?
Track a DragGesture's translation, scale and fade the view with progress, and on release dismiss if the distance or predictedEndTranslation passes a threshold, otherwise spring back. Drag to Dismiss wraps this in one modifier.
Keep browsing
Nearby collections, then every category in the library.
- Animations16Springs, gesture physics, transitions and morphs, across every category.
- Media8Photo viewing and cropping, story playback, attachments and link previews.
- Cards5Cards with depth, motion, parallax and gesture-driven stacks.
- Text4Type that reveals, expands, holds pictures and renders as glass.
- Backgrounds2Quiet atmospheres: a Metal silk shader and a touch-reactive dot grid.
- Liquid Glass5Correct iOS 26 Liquid Glass with Material fallbacks.
- Buttons and controls7Buttons and dials with press depth, hold, drag and outcome states.
- Inputs and forms17Tracks, steppers, rails and fields built for the thumb, down to addresses, map pins and signatures.
- Lists7Rows, grids and carousels with swipe, drag-to-select, follow-the-latest and completion physics.
- Navigation7Floating docks, tracking tabs, stretchy headers and an A to Z index.
- Sheets5Toasts, confirmations, permission moments and guided tours.
- Feedback5Reactions, ratings, status morphs, skeletons and outcomes.
- Data and charts6Scrubbable charts, rings, streak heatmaps, live stats and odometers.
- AI6Streaming replies, thinking states, prompt chips and answer sources.
- Haptics33Pieces that tick, tap and confirm at the moment that matters.
Ready to build something better?
85 pieces, one file each, yours to keep. Start with the library or see what the whole app looks like.