Disabling segue animation Disabling segue animation ios ios

Disabling segue animation


You can disable animations before performing the segue and after enable it again.

UIView.setAnimationsEnabled(false)self.performSegueWithIdentifier("next", sender: nil)UIView.setAnimationsEnabled(true)

This will perform the segue without the animation.


Click on segue arrow in Main.Storyboard and then:

enter image description here

Check out Animates


If you want to switch animate state in the code, You can duplicate your segue in the storyboard, with different identifiers, and the same origin and destination. Then make one of theme animates and the other not. Then, do performSegue with the desired identifier.

class MyNavigationController : UINavigationController {    var firstTransitionAnimated : Bool = true // or false, based on initialization    override func viewDidLoad() {        super.viewDidLoad()        var properSegue = firstTransitionAnimated ? "animated_segue" : "not_animated_segue"        self.performSegue(withIdentifier: properSegue, sender: self)    }}