DEV Community

Cover image for Build Custom Transitions in SwiftUI (Zoom, Modals, Flip Cards & More)
Karan Pal
Karan Pal

Posted on • Originally published at swift-pal.com

Build Custom Transitions in SwiftUI (Zoom, Modals, Flip Cards & More)

Let’s be honest:

You add one SwiftUI transition and suddenly…

  • The back gesture breaks
  • Matched geometry glitches
  • The animation works… but only on Tuesdays 🤷‍♂️

I ran into all of this — so I built custom transitions that actually work in real apps:

🎯 What we’ll build:

  • 📸 A Zoom-style photo transition using .navigationTransition(.zoom)
  • 📱 A card-to-detail expansion like the App Store
  • 🎭 A modal sheet with .presentationDetents() and drag indicator
  • 🔄 A flip card with 3D perspective using AnyTransition.modifier

Here's a sneak peek: Zoom transition with real navigation stack support

NavigationLink(value: photo) {
    PhotoThumbnail(photo)
}
.matchedTransitionSource(id: photo.id, in: namespace)

.navigationDestination(for: Photo.self) { photo in
    PhotoDetailView(photo: photo)
        .navigationTransition(.zoom(sourceID: photo.id, in: namespace))
}
Enter fullscreen mode Exit fullscreen mode

This is iOS 18’s new .navigationTransition(.zoom) done right —

no hacks, no broken swipe-backs, and full deep linking support.


Curious what the flip card animation looks like?

How I made a smooth slide+scale for onboarding?

How to make modals feel like native components?

👉 Read the full guide (with code + visuals)

Let’s finally make SwiftUI transitions feel as good as UIKit’s — but way less painful. 🚀

Top comments (0)