Hi Friends,
Easy to create your own custom animation for storyboardSegue.
Based on your project you can customise your storyboardSegue animations. If your application contains same background images in all screens means this fadeInPushSegue and fadeOutPopSegue animation will give better experience for customers (People can assume In this project developer used only one screen and implemented hole project in a single viewcontroller. But, we used multiple view controllers in our project.)
Here I have implemented a push and pop segue with fadeIn and fadeOut animations. Its better that pushViewController and popViewController Animations.
class FadeInPushSegue: UIStoryboardSegue { var animated: Bool = true override func perform() { let transition: CATransition = CATransition() transition.duration = 0.4 transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeIn) transition.type = CATransitionType.fade source.view.window?.layer.add(transition, forKey: "kCATransition") source.navigationController?.pushViewController(destination, animated: false) } }
class FadeOutPopSegue: UIStoryboardSegue { override func perform() { let transition: CATransition = CATransition() transition.duration = 0.4 transition.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut) transition.type = CATransitionType.fade source.view.window?.layer.add(transition, forKey: "kCATransition") source.navigationController?.popViewController(animated: false) } }
– How to make an iOS App
Kathiresan Murugan