Member-only story

New SwiftUI: Pinch to Zoom animation using Xcode 14

AnthonyDesignCode
5 min readNov 15, 2022

--

Photo by Markus Spiske on Unsplash

Hello everyone, welcome to a new SwiftUI tutorial. I hope you are all doing well. Today I am going to show you how to create a pinch to zoom animation in SwiftUI 4 and Xcode 14.

Let’s get started with opening up Xcode 14. I am going to get some of the Assets we used in the Splash Screen tutorial and add the here.

If you are looking for the link to the Splash Screen tutorial I will link it at the bottom. 👍

Otherwise let’s get going we are going to be creating a pinch to zoom gesture, we are going to create a new SwiftUI file called ZoomGesture. We are going to be using GeometryReader, @Binding Protocol and UIPinchGestureRecognizer and others.

What is a GeometryReader in SwiftUI?

A container view that defines its content as a function of its own size and coordinate space.

What is a @Binding Protocol in SwiftUI?

Use a binding to create a two-way connection between a property that stores data, and a view that displays and changes the data. A binding connects a property to a source of truth stored elsewhere, instead of storing data directly. For example, a button that toggles between play and pause can create a binding to a property of its parent view using…

--

--

AnthonyDesignCode
AnthonyDesignCode

Written by AnthonyDesignCode

Hey 👋 I’m Anthony! I hope you are well?! Thank you for looking at my blog. Here you will learn how to make apps in SwiftUI for iOS 16! Thanks for reading.

No responses yet