SwiftUI photo and media components
A full-screen photo viewer with pinch to zoom, a photo cropper, and a Stories-style progress strip with hold to pause.
About these pieces
One self-contained Swift file each, Apple frameworks only, from iOS 17.
Photo Viewer is a full-screen photo surface with anchor-correct pinch zoom, momentum panning that settles into the bounds, double-tap zoom about the tap, paging between images, and pinch-out or drag-down to dismiss.
Story Strip is a Stories-style segment strip with a built-in clock, a long-press hold that pauses it, tap zones for back and forward, and a manual progress mode when you own the timing.
Photo Cropper is the crop step after picking a photo: the photo always covers a frame of the chosen aspect, pinch zooms around the fingers while it pans, limits rubber-band, quarter turns keep the subject in frame, and the crop renders off the main thread at the original's full resolution.
Learn the technique: 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 crop an image in SwiftUI?
SwiftUI has no cropper. Show the photo under a fixed frame, keep its scale and offset clamped so it always covers the frame, then draw the original into a renderer at the frame's rect in the photo's own pixels. Photo Cropper does this with aspect presets, rotation and correct orientation.
How do I add pinch to zoom on an image in SwiftUI?
Combine MagnifyGesture for scale with a DragGesture for panning, anchor the zoom at the pinch location, and clamp the offset to the image bounds. Photo Viewer handles all of that plus double-tap zoom and paging.
Keep browsing
Nearby collections, then every category in the library.
- Motion1Gesture modifiers with real physics.
- Cards5Cards with depth, motion, parallax and gesture-driven stacks.
- Navigation7Floating docks, tracking tabs, stretchy headers and an A to Z index.
- 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.
- 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.
- Animations16Springs, gesture physics, transitions and morphs, across every category.
- 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.