Hello everyone!
Today I’m going to show a simple way to use Swipe and Pinch gesture with Swift.

I have added the following images to my Assets folder on which I want to apply the Swipe and Pinch gesture.

Create a project and add a UIImageView to the controller.

From your Object Library drag and drop two UISwipeGestureRecognizer and set one swipe to Left and the other to Right.

Also add a UIPinchGestureRecognizer.

Create an action for UISwipeGestureRecognizer and connect both objects to the same action and in your controller.


and another for UIPinchGestureRecognizer.


Make UIImageView‘s reference outlet in the controller’s class.


In action of UISwipe


and in action of UIPinch

Connect UIImageView reference to UISwipe and UIPinch GestureRecognizer.

and Make sure that User Interaction is Enabled.

Finally run your app, you should be getting something like this.
[vimeo 151238307]

Source on Github
So long. 🙂



Leave a Reply

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