Latest 0.1.1
Homepage https://github.com/joelconnects/FlipTheBlinds
License MIT
Platforms ios 10.0
Authors

Platform
Language
Swift 3.0
License

FlipTheBlinds is an animation transition that creates a venetian blinds domino effect.

Features

  • Animation transition for use in presentations, navigation, and switching between tabs.
  • Modal presentations can be programmatic or implemented using segues.
  • Transition direction and speed is customizable.
  • Designed for portrait device orientation.
  • Swift 3.0

Demo

Screen Capture

Animated GIF

Requirements

  • iOS 8.0+
  • Xcode 10.0+

Usage

Installation

  pod "FlipTheBlinds"

Modal Presentations

  • Assign the transitioningDelegate property of the view controller being presented to the presenting view controller.
  • Add an extension to the presenting view controller that includes methods for the UIViewControllerTransitioningDelegate.
  • Return instances of the FTBAnimationController animator object using FTBAnimationController(displayType:direction:speed:) for presenting and dismissing.

  // MARK: Programmatic option

  func presentAction() {

    let toViewController = ToViewController()
    toViewController.transitioningDelegate = self
    self.present(toViewController, animated: true, completion: nil)

  }

  // MARK: Segue option

  func prepare(for segue: UIStoryboardSegue, sender: Any?) {

      if segue.identifier == "segue", let destinationViewController = segue.destination as? toViewController {

          destinationViewController.transitioningDelegate = self

      }

  }

  // MARK: Transitioning Delegate

  extension fromViewController: UIViewControllerTransitioningDelegate {

    func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {

        return FTBAnimationController(displayType: .present, direction: .up, speed: .moderate)

    }

    func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {

        return FTBAnimationController(displayType: .dismiss, direction: .down, speed: .moderate)

    }

  }

Navigation

  • Assign the delegate property of the navigation controller to the root view controller.
  • Add an extension to the root view controller that includes the UINavigationControllerDelegate and necessary transitioning method.
  • Return instances of the FTBAnimationController animator object using FTBAnimationController(displayType:direction:speed:) for push and pop.

  // MARK: Push

  func pushAction() {

      let navStackViewController = NavStackViewController()
      self.navigationController?.delegate = self
      self.navigationController?.pushViewController(navStackViewController, animated: true)

  }

  // MARK: Navigation Controller Delegate

  extension NavRootViewController: UINavigationControllerDelegate {

   func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {

       switch operation {
       case .pop:
           return FTBAnimationController(displayType: .pop, direction: .right, speed: .moderate)
       case .push:
           return FTBAnimationController(displayType: .push, direction: .left, speed: .moderate)
       default:
           return nil
       }

   }

  }

Tab Bar

  • Assign the delegate property of the tab bar controller to one of the root view controllers of the tab bar controller.
  • Add an extension to a root view controller that includes the UITabBarControllerDelegate and necessary transitioning method.
  • Return an instance of the FTBAnimationController animator object using FTBAnimationController(displayType:direction:speed:).

  // MARK: Delegate

  override func viewDidLoad() {
      super.viewDidLoad()

      self.tabBarController?.delegate = self

  }

  // MARK: Tab Bar Controller Delegate

  extension TabBarRootOneViewController: UITabBarControllerDelegate {

      func tabBarController(_ tabBarController: UITabBarController, animationControllerForTransitionFrom fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {

          return FTBAnimationController(displayType: .tabSelected, direction: .down, speed: .moderate)

      }

  }

Known Issues

  • Drawing/Rendering images in the animator object is problematic for the simulator, especially iPhone 7/7P. Device testing is recommended.
  • drawHierarchy(in:afterScreenUpdates:) is used for modal presentations and may cause an inconspicuous flicker.

License

  • FlipTheBlinds is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "FlipTheBlinds",
    "version": "0.1.1",
    "summary": "An animation transition creating a venetian blinds domino effect",
    "description": "FlipTheBlinds is an animation transition that creates a venetian blinds domino effect",
    "homepage": "https://github.com/joelconnects/FlipTheBlinds",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Joel Bell": "[email protected]"
    },
    "source": {
        "git": "https://github.com/joelconnects/FlipTheBlinds.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source_files": "FlipTheBlinds/FTB*.swift",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This