Saturday, June 13, 2026
HomeiOS Developmentios - CATransition Swift - Revert animation to show earlier display screen

ios – CATransition Swift – Revert animation to show earlier display screen

[ad_1]

I wish to do revert this animation, precisely the identical however within the different approach to return (not a push from proper to left to see the earlier display screen, however a slide of the second view in direction of the suitable to disclose the earlier (first) view below it). Am I clear?

Here is the code for the primary animation, to current the second view from the suitable :

   open func presenter(_ viewControllerToPresent: UIViewController, animated flag: Bool, pushing: Bool, completion: (() -> Void)? = nil) {
            
            if pushing {
                
                let transition = CATransition()
                transition.length = 0.25
                transition.sort = CATransitionType.moveIn
                transition.subtype = CATransitionSubtype.fromRight
                transition.timingFunction = CAMediaTimingFunction(title: CAMediaTimingFunctionName.easeOut)
                view.window?.layer.add(transition, forKey: kCATransition)
                viewControllerToPresent.modalPresentationStyle = .fullScreen
                self.current(viewControllerToPresent, animated: false, completion: completion)
                
            } else {
                self.current(viewControllerToPresent, animated: flag, completion: completion)
            }
            
        }

What may I do to revert it? Thanks

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments