SAHistoryNavigationViewController realizes iOS task manager like UI in UINavigationContoller.
Clone or download
Pull request Compare This branch is 9 commits behind marty-suzuki:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
SAHistoryNavigationViewController
SAHistoryNavigationViewControllerSample
SampleImage
.gitignore
.travis.yml
LICENSE
README.md
SAHistoryNavigationViewController.podspec

README.md

SAHistoryNavigationViewController

Platform Language Version License

Support 3D Touch for iOS9!!

SAHistoryNavigationViewController realizes iOS task manager like UI in UINavigationContoller.

ManiacDev.com referred.
https://maniacdev.com/2015/03/open-source-component-enhancing-the-back-button-with-view-history-navigation

Features

  • iOS task manager like UI
  • Launch Navigation History with Long tap action of Back Bar Button
  • Support Swift2.0
  • Support 3D Touch (If device is not supported 3D Touch, automatically replacing to long tap gesture.)

Installation

CocoaPods

SAHistoryNavigationViewController is available through CocoaPods. If you have cocoapods 0.38.0 or greater, you can install it, simply add the following line to your Podfile:

pod "SAHistoryNavigationViewController"

Manually

Add the SAHistoryNavigationViewController directory to your project.

Usage

If you install from cocoapods, You have to write import SAHistoryNavigationViewController.

Storyboard or Xib

Set custom class of UINavigationController to SAHistoryNavigationViewController. In addition, set module to SAHistoryNavigationViewController.

Code

You can use SAHistoryNavigationViewController as self.navigationController in ViewController, bacause implemented extension UINavigationController as below codes and override those methods in SAHistoryNavigationViewController.

extension UINavigationController {
  public weak var historyDelegate: SAHistoryNavigationViewControllerDelegate? {
      set {
          willSetHistoryDelegate(newValue)
      }
      get {
          return willGetHistoryDelegate()
      }
  }
  public func showHistory() {}
  public func setHistoryBackgroundColor(color: UIColor) {}
  public func contentView() -> UIView? { return nil }
  func willSetHistoryDelegate(delegate: SAHistoryNavigationViewControllerDelegate?) {}
  func willGetHistoryDelegate() -> SAHistoryNavigationViewControllerDelegate? { return nil }
}

And you have to initialize like this.

let ViewController = UIViewController()
let navigationController = SAHistoryNavigationViewController()
navigationController.setViewControllers([ViewController], animated: true)
presentViewController(navigationController, animated: true, completion: nil)

If you want to launch Navigation History without long tap action, use this code.

navigationController?.showHistory()

Customize

If you want to customize background of Navigation History, you can use those methods.

navigationController?.contentView()
navigationController?.setHistoryBackgroundColor(color: UIColor)

This is delegate methods.

@objc public protocol SAHistoryNavigationViewControllerDelegate: NSObjectProtocol {
    optional func historyControllerDidShowHistory(controller: SAHistoryNavigationViewController, viewController: UIViewController)
}

Requirements

Author

Taiki Suzuki, s1180183@gmail.com

License

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