A Library of essential ViewController transitions! Built with swift 3.
In YourViewController.swift, you should create a global variable like so:
var transition = UIViewControllerAnimatedTransitioning?
Along with adding an extension to the viewController.swift at the very bottom of the file like so:
extension YourViewController: UIViewControllerTransitioningDelegate {
func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return transition
}
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return nil
}
}
This extension will manage any incoming segue and if the 'transition' variable has been set to one of the classes defined in this repo, it will utilize the animation within that class as the transition.
- If you feel comfortable with these transitions, Go on to the more advanced next step: Interactive swipe gesture transitions