Latest 0.3.0
License MIT
Platforms ios 8.0



CustomPresenter is an implementation of UIViewControllerAnimatedTransitioning which is a set of methods for implementing the animations for a custom view controller transition (read more here).

This library provides implementation for presentation (CustomControllerPresentationAnimator) and dismissal (CustomControllerDismissAnimator) of view controller. Transition can be customized using presentation context:

protocol CustomControllerPresentationContext {

    // Transition properties

    var backgroundViewForPresentation: UIView? { get set }
    var backgroundAlpha: CGFloat { get }
    var duration: TimeInterval { get }
    var animationSpringDumping: CGFloat? { get }
    var animationInitialSpringVelocity: CGFloat? { get }

    // Optional object that controls presentation/dismissal animation

    var animationDriver: CustomControllerPresentationAnimationDriver? { get }

    // Final frame of presented view controller or initial frame of dismissed one;
    // `transitionedView` is presented view during presentation, or dismissed one if we are undergoing dismissal

    func controllerFrame(for containerView: UIView, transitionedView: transitionedView) -> CGRect 


To use CustomPresenter with your view controller you need to follow these 3 steps:

  • set modalPresentationStyle to .custom for your view controller
  • create implementation of CustomControllerPresentationContext that will describe transition (don’t worry, all properties have default values provided by extension, so little effort is required).
  • make sure that your view controller is becomes transitioningDelegate and implement delegate method:

class MyViewController: UIViewController {
    private class MyPresentationContext: CustomControllerPresentationContext {}

    private var myPresentationContext = MyPresentationContext()

extension MyViewController: UIViewControllerTransitioningDelegate {
    func animationController(forPresented presented: UIViewController,
                             presenting: UIViewController,
                             source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        return CustomControllerPresentationAnimator(presentationContext: myPresentationContext)

    func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        return CustomControllerDismissAnimator(presentationContext: myPresentationContext)


Please note that if you are presenting your view controller wrapped in UINavigationController, then you have to make sure that modalPresentationStyle is set to .custom on navigation controller and transitioningDelegate is set to your view controller that implements it as in example above.


iOS 8, Swift 4



CustomPresenter is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'CustomPresenter'


Simply add to your Cartfile:

github "azubala/CustomPresenter"


Aleksander Zubala |


CustomPresenter is available under the MIT license. See the LICENSE file for more info.

Latest podspec

    "name": "CustomPresenter",
    "version": "0.3.0",
    "summary": "Custom view controller transitioning implementation",
    "description": "CustomPresenter provides a straighforward implementation of custom view controller transitioning for presentation and dismissal. It provides control over timing, background and metrics of presented view controller.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "azubala": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.3.0"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0"
    "source_files": "CustomPresenter/Classes/**/*",
    "swift_version": "4.0"

Pin It on Pinterest

Share This