Custom View Controller Transitioner
It handles the presenting of a view controller with custom transitions.
- Swift 3.0
- xcode 8
-
Transitions supported:
-
Bottom
-
Top
-
Left
-
Right
-
Center
-
Also the following properties of the presenting controller can be modified according to the requirement:
-
Duration
-
Size
-
Screen Insets
-
Transition Type
-
Back Drop View (optional) : Greyish view between presenting controller and the presented controller. It is optional to use Back Drop View.
-
Dismiss on background tap (optional) : If the presented controller size is less than tha screen size, it can be dismissed on the background tap as well.
To add custom animation to a controller to be presented (Eg. Controller), do the following
-
Conform Controller to "UIViewControllerTransitioningDelegate" protocol
-
Implement these methods of UIViewControllerTransitioningDelegate protocol: a) animationControllerForPresentedController b) animationControllerForDismissedController c) presentationControllerForPresentedViewController (optional) - For Back Drop View
-
Set "transitioningDelegate" property of Controller to "self"
-
Set "modalPresentationStyle" property of Controller to ".Custom"
Comments are included in the project files to better understanding of the flow.
