Latest 0.1.0
Homepage https://github.com/brenoxp/BXTransition
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Gif

Usage – Present

import BXTransition

class ViewController: UIViewController {

  var transition: BXTransition!
  let interactor = Interactor()

  override func viewDidLoad() {

  }

  override func viewDidAppear(_ animated: Bool) {
    transition = BXTransition(viewController: self)
    transition.interactor = interactor

    let storyboard = UIStoryboard(name: "Main", bundle: nil)

    let viewController1 = storyboard.instantiateViewController(withIdentifier: "ViewController1")
    viewController1.transitioningDelegate = self
    transition.set(viewController: viewController1, forDirection: .right)
  }

  @IBAction func pangGesture(_ sender: Any) {
    guard let gesture = sender as? UIGestureRecognizer else { return }
    transition.panGesture(view: view, gesture: gesture)
  }
}

extension ViewController: UIViewControllerTransitioningDelegate {
  func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
    return transition
  }

  func interactionControllerForPresentation(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
    return interactor.hasStarted ? interactor : nil
  }
}

Usage – Dismiss

import BXTransition

class ViewController1: UIViewController {
  var transition: BXTransition!
  let interactor = Interactor()

  override func viewDidAppear(_ animated: Bool) {
    transitioningDelegate = self

    transition = BXTransition(viewController: self)
    transition.interactor = interactor
    transition.setDismiss(directionAccepted: .left)
  }

  @IBAction func pangGesture(_ sender: Any) {
    guard let gesture = sender as? UIGestureRecognizer else { return }
    transition.panGesture(view: view, gesture: gesture)
  }
}

extension ViewController1: UIViewControllerTransitioningDelegate {
  func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
    return transition
  }

  func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
    return interactor.hasStarted ? interactor : nil
  }
}

Installation

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

pod 'BXTransition'

Author

Breno Xavier – [email protected]

License

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

Latest podspec

{
    "name": "BXTransition",
    "version": "0.1.0",
    "summary": "BXTransition is a smooth and simple way to made your iOS app more interactive.",
    "swift_version": "4.1",
    "description": "With BXTransition you can add the same transition that Instagram and Snapchat have on their app with just a few lines of code.",
    "homepage": "https://github.com/brenoxp/BXTransition",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "[email protected]": "[email protected]"
    },
    "source": {
        "git": "https://github.com/brenoxp/BXTransition.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "BXTransition/Classes/**/*"
}

Pin It on Pinterest

Share This