From the course: SwiftUI Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Matched geometry

Matched geometry

- [Instructor] Swift UI has one more kind of animation, match geometry. This interesting animation is for moving one view to another view. For example, if I wanted to animate a move from a selection to favorites and back, I could use this animation with only a few lines of code. Let's give it a try. Now, there's two important rules you got to remember about match geometry I'll mention first. The first one we've already taken care of, and that is you got to have some animation. It'll only work if other animation is there. So we've got our two animations here, already in place, so that should solve that problem. The second one is the reason we wanted to keep unique views, and that is you can only have that view showing in one place. So if I can only have one margarita pizza on the screen. If I have one here and one here, you're going to get some crazy results. So you want to make sure you have only one here and or one…

Contents