Transitions
Transitions
Intro
Transitioning from one view controller to another is always great way to show how the views or the flow of data / work is being carried out.
It can literally make or break the User Experience of the end user and also needs to be not done overly complicated with too many animations.
Looking for sweet spot is important in that aspect.
Delegates
Custom Transition Animation
You can always go for custom transition animation route when you're ready for it.
For Navigation Controller embedded transitions
// 1
customViewController.modalPresentationStyle = .fullScreen
// 2
let transition = CATransition()
transition.duration = 0.2
transition.timingFunction = CAMediaTimingFunction(name: .easeOut)
transition.type = .push
transition.subtype = .fromLeft
// 3
navigationController.view.window?.layer.add(transition, forKey: kCATransition)
navigationController.present(customViewController, animated: false)
})
For default UIViewController transitions
self?.view.window?.layer.add(transition, forKey: kCATransition)
self?.dismiss(animated: false, completion: nil)
Important Note
When using custom transitions make sure that you disable the animated bool flag by passing 'false' value when calling default UI functions.