SlideKit 0.0.7

SlideKit 0.0.7

Maintained by Kyler Jensen.




SlideKit 0.0.7

  • By
  • Kyler Jensen

SlideKit

Soulfully slidey UINavigationController transitions.

Quickly and easily create onboarding flows with a background image or transparent top and bottom bars based on simple UINavigationController semantics.

Getting Started

SlideKit comes with several ways, with varying degrees of intrusiveness, to implement sliding push and pop transitions for UINavigationController. This section gives instructions for adding the framework to your project, as well as getting started using Interface Builder or just code.

Adding SlideKit to Your iOS project

SlideKit can be installed using CocoaPods or Carthage.

CocoaPods
pod 'SlideKit'
Carthage
github "Kjens93/SlideKit"

Using SlideKit

SlideKit can be used via Interface Builder, code, or a combination of the two.

Using SlideKit with Interface Builder

To add slidey transitions to your navigation flow, just change your UINavigationController to an instance of SlideNavigationController.

Without writing a single line of code, your navigation flow will begin to move with slidey transitions. You can further customize your transitions in code by interacting with the navigationController of any view controller in your navigation flow. For example, you can change a push transition's spring damping ratio by adding the following code to your view controller's viewWillAppear(animated:) method:

import SlideKit

class ViewController: UIViewController {

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated: animated)
        let slideNavigationController = self.navigationController as? SlideNavigationController
        slideNavigationController?.pushTransition.springDampingRatio = 0.75
    }
    
}

As an alternative, you can create a subclass of SlideNavigationController and customize it in your subclass' viewDidLoad() method.

Using SlideKit in Code

import SlideKit

class CustomNavigationController: SlideNavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        //Customize push and pop transition animation timings
        pushTransition.delay = 0.15
        pushTransition.duration = 0.45
        popTransition.springDampingRatio = 0.75
        popTransition.animationOptions = [.curveEaseInOut]
        popTransition.backgroundColor = .clear
        //etc...
        
        //Add a background image to navigation stack for onboarding experience
        let imageView = UIImageView(image: UIImage(named: "BackgroundImage"))
        imageView.contentMode = .scaleAspectFill
        imageView.clipsToBounds = true
        imageView.frame = view.bounds
        imageView.autoResizingMask = [.flexibleWidth, .flexibleHeight]
        view.insertSubview(imageView, at: 0)
        view.layoutIfNeeded()
        //etc...
        
        //Make the navigation bar transparent for a cleaner onboarding experience
        navigationBar.backgroundColor = .clear
        navigationBar.shadowImage = UIImage()
        navigationBar.setBackgroundImage(UIImage(), for: .default)  
        
    }

}