Latest0.8.0
Homepagehttps://github.com/marty-suzuki/SAInboxViewController
LicenseMIT
Platformsios 8.0, requires ARC
DependenciesMisterFusion
Authors

Platform
Language
Version
License

SAInboxViewController

SAInboxViewController realizes Inbox like view transitioning.

You can launch sample project on web browser from here.

Features

  • [x] Inbox like view transitioning
  • [x] Scrolling up to begining of contents transitioning
  • [x] Scrolling down to end of contents transitioning
  • [x] Header dragging transitioning
  • [x] Left edge swiping transitioning
  • [x] HeaderView hide animation
  • [ ] Change StatusBar color with scrolling
  • [x] Support Swift3
  • [x] Support Siwft3.1

Installation

CocoaPods

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

pod "SAInboxViewController"

Manually

Add the SAInboxViewController directory to your project.

Usage

If you install from cocoapods, you have to write import SAInboxViewController.

First of all, please use SAInboxViewController with UINavigationController.

There are two ViewControllers to realize Inbox transitioning. Please extend those ViewControllers.

  1. SAInboxViewController… using as rootViewController
  2. SAInboxDetailViewController… using as second ViewController

Those ViewControllers have UITableView, so implement ordinary UITableView behavior with that tableView.

If you use UITableViewDelegate in ViewController which extends SAInboxDetailViewController, please call super methods for below two methods.

override func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) {
    super.scrollViewDidEndDragging(scrollView, willDecelerate: decelerate)
}

override func scrollViewDidScroll(scrollView: UIScrollView) {
    super.scrollViewDidScroll(scrollView)
}

If you want to present ViewController from rootViewController, implement func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) like this.

@objc(tableView:didSelectRowAtIndexPath:)
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    let viewController = SAInboxDetailViewController()
    if let cell = tableView.cellForRow(at: indexPath), let image = headerView.screenshotImage() {
        SAInboxAnimatedTransitioningController.shared.configureCotainerView(self, cell: cell, cells: tableView.visibleCells, headerImage: image)
    }
    navigationController?.pushViewController(viewController, animated: true)
}

Implement UINavigationControllerDelegate methods, like this.

func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
    return SAInboxAnimatedTransitioningController.shared.setOperation(operation)
}

Customize

You can change HeaderView barTintColor, tintColor and titleTextAttributes.
There are 2 ways to change HeaderView Appearance.

Application Base Appearance

SAInboxViewController class has Appearance property

SAInboxViewController.appearance.barTintColor = .black
SAInboxViewController.appearance.tintColor = .white
SAInboxViewController.appearance.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white]

ViewController Base Appearance

SAInboxViewController instance has Appearance property.

override func viewDidLoad() {
    super.viewDidLoad()
    appearance.barTintColor = .white
    appearance.tintColor = .black
    appearance.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.black]

    //Do not forget to set true
    enabledViewControllerBasedAppearance = true
}

Requirements

  • Xcode 8.0 or greater
  • iOS 8.0 or greater
  • MisterFusion (Swift DSL for AutoLayout)

Author

Taiki Suzuki, [email protected]

License

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

Latest podspec

{
    "name": "SAInboxViewController",
    "version": "0.8.0",
    "summary": "UIViewController subclass inspired by "Inbox by google" animated transitioning.",
    "homepage": "https://github.com/marty-suzuki/SAInboxViewController",
    "license": "MIT",
    "authors": {
        "Taiki Suzuki": "[email protected]"
    },
    "source": {
        "git": "https://github.com/marty-suzuki/SAInboxViewController.git",
        "tag": "0.8.0"
    },
    "social_media_url": "https://twitter.com/marty_suzuki",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "SAInboxViewController/*.{swift}",
    "dependencies": {
        "MisterFusion": []
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This