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.

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 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.

Next

Ready to build something better?

55 pieces, one file each, yours to keep. Start with the library or see what the whole app looks like.