Latest 0.1.7
Homepage https://github.com/PabloAlejandro/Transitions
License MIT
Platforms ios 8.0
Frameworks UIKit
Authors

Transitions library provides an easy way to present different view controllers with a transition animation, which may be interactive, by just subclassing your view controller.

Usage

Firstly you need to import the library in the view controller you want to subclass by adding import Transitions.

Then, just subclass by using the right view controller object:

  • TransitionViewController
  • TransitionNavigationController
  • TransitionTabBarController

When initialising your subclass, initialise its transitionConfiguration property:

let properties = TransitionProperties(duration: 0.5, modalPresentationStyle: .overFullScreen)
let configuration = TransitionConfiguration.noninteractive(transitionProperties: properties)
self.transitionConfiguration = configuration

And finally, use the public method in your subclass in order to present or dismiss a new view controller with a custom animation, by just defining a block wit the animation:

let vc = UIViewcontroller()
let presentBlock = { (transitionContext: UIViewControllerContextTransitioning, duration: TimeInterval) in
    let toViewController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)!
    let containerView = transitionContext.containerView
    toViewController.view.alpha = 0.0
    containerView.addSubview(toViewController.view)
    UIView.animate(withDuration: duration, animations: {
        toViewController.view.alpha = 1.0
    }, completion: { finished in
        transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
    })
}
self.present(vc, presentBlock: presentBlock)

Files

Controllers

  • TransitionViewController -> UIViewController subclass which allows present/dismiss interactive transitions by using an instance method.
  • TransitionNavigationController ->UINavigationController subclass which allows push/pop interactive transitions by using an instance method.
  • TransitionTabBarController -> UITabBarController subclass which allows select interactive transitions by using an instance method.

Classes

  • Transition -> Protocol and objects declarations.
  • GenericTransition -> Main manager implementing Transition protocols.

Latest podspec

{
    "name": "Transitions",
    "version": "0.1.7",
    "summary": "Simple way of presenting a view controller by using transition animations, which may be interactive.",
    "homepage": "https://github.com/PabloAlejandro/Transitions",
    "description": "Transitions library provides an easy way to present different view controllers with a transition animation, which may be interactive, by just subclassing your view controller.nBy subclassing your view controller with the right transition controller, you will be able to present/dismiss, push/pop, select, a new view controller with a custom *interactive* animation with a simple call, without having to worry about implementing any `UIViewControllerInteractiveTransitioning` or `UIViewControllerAnimatedTransitioning`.",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Pablo A. Pu00e9rez-Martu00ednez (Pau)": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/PabloAlejandro/Transitions.git",
        "tag": "0.1.7"
    },
    "source_files": [
        "Transitions/Controllers/*.{swift}",
        "Transitions/Classes/*.{swift}"
    ],
    "frameworks": "UIKit",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This