Skip to content

SwiftUI: Magnification Gesture

Last updated on April 29, 2020

Magnification tracks the distance between two fingers indicating if it’s moving closer or away from each other. This would then scale the effect to either larger or smaller.

A gesture that recognizes a magnification motion and tracks the amount of magnification.

Apple Documentation

In this tutorial, you’ll learn what is Magnification Gesture in SwiftUI. You’ll learn:

  • How to use Magnification Gesture.


To follow along this tutorial, you’ll need some basic knowledge in:

  • A basic familiarity with Swift.
  • At least Xcode 11

Magnification Gesture

The most popular Magnification gesture can be found in Photo where you could magnify a photo by scaling it larger or smaller. Now, you will attempt to magnify a Tesla image.

You will need a GestureState to store the value.

Then you will need to create an image which will also take the scale value. With every zooming in, the value will be stored in the scale and reuse again.

As a result, you will find it very magnifying. We could almost certainly tell who is in the Tesla.

Where to go From Here

If you feel like you are ready to take on more challenges, feel free to check out some other tutorials that we have created:

Published inSwiftUI

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *