Implementation of Gesture Recognizer as Segue between two view controllers


I am building an app called Single Photo. It is part of the "Learn to Code" iBook from Apple. I have built the original app, but now would like to expand on it.

I have added a second View Controller to Main.storyboard, as well as a UIImageView. However, I am not sure how to connect the two View Controllers together. I know that I have to add a segue, but I want to use a swipe gesture (like a photo gallery). It was recommended that I use UIPanGestureRecognizer as an alternative to UISwipeGestureRecognizer.

My confusion is that I am not sure how to implement either UIGestureRecognizer. Do I have to implement it as the segue between the two View Controllers? That would make sense.

tl;dr: How do I implement UIGestureRecognizer as a segue between two View Controllers?

EDIT: When I make some changes, I get the errors seen in the screenshot. {1}: {1}

I'd be using the Swipe gesture for that; for me it seems the most natural one for changing views with touch?

Whilst I don't know Swift yet sadly, this is how i would do it;

  1. Add a gesture recogniser object onto your view using Interface Builder. You'll find it in the list of objects to add (Label, TextField, etc).

  2. Add an IBAction method in your ViewController.m and declare it in your .h also like:

- (IBAction)handleSwipe:(UISwipeGestureRecognizer *)recognizer

  1. Connect the gesture recogniser in Interface Builder to the IBAction as a 'Sent Action'

  2. Make a new Segue by Control-clicking on the first view controller and dragging the blue line to the second view. Give this segue a unique identifier and set the style of segue.

  3. Handle the gesture in the IBAction based on direction of swipe and call the segue from here;

    [self performSegueWithIdentifer:@"theSegue" sender:self];

See if that gets you there