Swift - performseguewithidentifier transition style from right to left

1.6k views Asked by At

How can I make a transition from left to right using performseguewithidentifier? What I want to do is when user swipe to right, the page/view controller's transition will switch from right to left, normally it will swipe from left to right. Is this possible?

My code:

override func viewDidLoad() {

var swipeRight = UISwipeGestureRecognizer(target: self, action: "respondToSwipeGesture:")
        swipeRight.direction = UISwipeGestureRecognizerDirection.Right
        self.view.addGestureRecognizer(swipeRight)

    }


    func respondToSwipeGesture(gesture: UIGestureRecognizer) {

        if let swipeGesture = gesture as? UISwipeGestureRecognizer {

            switch swipeGesture.direction {
            case UISwipeGestureRecognizerDirection.Right:
                performSegueWithIdentifier("LeftSegue", sender: self)
                println("Swiped right")
            default:
                break
            }
        }
    }
1

There are 1 answers

0
Adam Szeptycki On

You have to write your own custom interactive transition. Here and here you can find example tutorial. It's quite easy but have a little bit of boiler plate code.