MatchedGeometryEffect: Shared Element Hero Transitions
MatchedGeometryEffect lets two views share one spatial identity, so a thumbnail can appear to fly into a detail sheet across view hierarchies. It only works if both views exist simultaneously during a withAnimation block; otherwise the transition snaps.
MatchedGeometryEffect gives two different views a shared spatial identity so SwiftUI can animate a seamless frame transition between them, even across unrelated view hierarchies. It is the engine behind hero animations like a grid photo expanding into a full-screen detail view. The common footgun is treating it like magic: both source and destination views must exist at the same time inside a withAnimation block, and they must share the same Namespace.ID and unique identifier, or the morph will snap instead of interpolating.
Read the original → direct-llm://matchedgeometryeffect
- #swiftui
- #animation
- #matchedgeometryeffect
- #ios
- #transitions
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.