Learn how to develop a drag gesture with SwiftUI for an iOS mobile application

Опубликовано: 20 Октябрь 2024
на канале: Credo Academy
744
16

🟢 LIMITED TIME OFFER - SAVE 37%
Practical iOS and macOS app development tutorials with SwiftUI in 4K
https://credo.academy

Practical iOS and macOS app development tutorials with SwiftUI in 4K
https://credo.academy

CREDO ACADEMY

In this tutorial, we will develop a sophisticated drag gesture for this SwiftUI application.

What I mean by saying developing a sophisticated gesture is how this specific drag feature works in various situations.

Now please, pay close attention to this demo so that you can see it in action.

As you can notice, first, I am dragging and moving the cover image around the screen.

However, when I release my finger from the screen, then you can notice how this cover image is being snapped back to its original position.

This snap-to-back feature only works when the image is not scaled up.

And this is one of the many desired behaviors that we need to cover through developing this complex feature.

Next.

Now let’s see what’s happening when we first zoom in on the image, then drag and move around it.

As you can see, it works without any glitches, and we can release our fingers from the screen wherever we want.

And the scaled-up image will stay in that particular position on the screen.

Now watch carefully for what will happen when we double-tap the image at some specific scale and position.

Here it goes!

Did you notice how suddenly the cover image shrank down and moved back simultaneously to the original position and scale?

That is what I was talking about.

How fantastic is that?

Now let me repeat it one more time so you can catch it again.

I hope you like it.

We will add another valuable feature to this Pinch & Zoom application by the end of this class.

Alright!

Enough with the talk.

Let’s fire up Xcode and start coding along with me.

This 4K tutorial is part of the bestseller SwiftUI Masterclass course with more than 13 thousand students at the Credo Academy.

#SwiftUI #CredoAcademy #iOSDevelopment