I wrote the following code to have a transition from right to left from one to another view controller. But the new view controller just appears without animation.
override func perform() {
var sourceViewController = self.sourceViewController as! UIViewController
var destinationViewController = self.destinationViewController as! UIViewController
var transition: CATransition = CATransition()
transition.duration = 1.25
transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
transition.type = kCATransitionPush
transition.subtype = kCATransitionFromRight
destinationViewController.view.layer.addAnimation(transition, forKey: "kCATransition")
sourceViewController.presentViewController(destinationViewController, animated: false, completion: nil)
}
I just can't find any mistake. Can anyone find one? Am I missing something simple?
Thank you in advance
change this code:
to the new one: