Why SwiftUI Image Zoom Feels Wrong — and When UIScrollView Is the Answer
The Problem I needed a full-screen image viewer for a document scanning app. Pinch to zoom in, drag to pan around while zoomed. Standard stuff. Surely SwiftUI can handle this natively, right? The Journey Attempt 1: MagnifyGesture Only The straightforward approach: Image(uiImage: uiImage) .scaleEffect(scale) .gesture( MagnifyGesture() .onChanged { value in scale = max(1.0, value.magnification) } .onEnded { _ in withAnimation { scale = 1.0 } } ) Releasing fingers snaps back to 1x. Adding lastScale to persist the zoom level works, but now there’s no way to pan the zoomed image. ...