Animating swift storyboard segue

27 Views Asked by At

I am trying to on a button click, animate my story board see I have named "goToLoggin". The animation is suppose to slide the current view controller over to the right, pulling the other view controller in view after it. My code does something close to it but not quite. I animates behind the standard animation to the left, when I hit the button. Any help is appreciated.

  ` override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier == "goToLoggin" {
        // Set the custom animation transition
        let transition = CATransition()
        transition.duration = 0.3
        transition.type = CATransitionType.push
        transition.subtype = CATransitionSubtype.fromLeft
        transition.timingFunction =
        CAMediaTimingFunction(name:CAMediaTimingFunctionName.easeInEaseOut)
        // Add the transition to the view's layer
        self.view.layer.add(transition, forKey: kCATransition)
        }
     }



        @IBAction func returntoLogginTapped(_ sender: Any) {
       performSegue(withIdentifier: "goToLoggin", sender: self)
    }`
0

There are 0 best solutions below