Latest 0.1.2
License MIT
Platforms ios 10.0


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


  • iOS 10.0 and later
  • Xcode 9.0 and later
  • Swift 4.0


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

pod 'SceneCoordinator'



The purpose of SceneCoordinator is to simplify navigation among UIViewControllers in iOS, so that:

  • UIViewControllers are isolated from each other
  • UIViewControllerDelegates are no longer needed.
  • Navigation codes are reduced as much as down to a single line.


// Push Operation
SceneCoordinator<Main>.push(to: .firstViewController, animated: true)

// Presen Operation 
SceneCoordinator<PresentNav>.presentNav(with: .navFirstChildViewController, animated: true)

// Pop Operation
SceneCoordinator<Main>.popToPrevious(animated: true)

// Dimiss operation 
SceneCoordinator<Nav>.dismiss(animated: true)

// TabSelection Operation

Set Up

Setup, ideally an enum, and conform it to SceneType :

enum Main{
    case first

extension Main : SceneType{
    var storyboard: String {
        return "Main"

    var viewControllerType: UIViewController.Type {
        return FirstViewController.self

    var storyboardBundle: Bundle? {
        return nil 

Note1: you don’t have to create Nav and Tab sceneTypes. They are defined by SceneCoordinator framework by default to perform

  • dismiss function for Nav
  • selectTab function for Tab

Note2: The framework gets the UIViewControllers from storyboard via their IDs, so please name every UIViewController’s storyboardID the same as the class name

screen shot 2018-09-21 at 4 21 20 pm

Now, you can navigate to whatever viewControllers which are defined in Main.

SceneCoordinator<Main>.push(to: .first, animated: true)

Passing Data

push, present and all have overload functions that accept a data parameter which is in [String : Any] format.

// push
SceneCoordinator<Main>.push(to: .firstViewController, withData: ["data" : "FromMain"], animated: true)

// present
SceneCoordinator<PresentSingleView>.presentView(scene: .presentSingleFirstViewController, withData: ["data" : text], animated: true)

SceneCoordinator<Tab>.select(2, withData: ["push" : true])

Retrieving Data

Override willMoveToInterface in ViewController to retrieve data from push, present and operations.

override func willMoveToInterface(with data: [String : Any]) {
// `From:` is a framework defined key
// Read the value to know which viewController initiated the navigation
    if let fromViewController = data["From:"]{

    if let data = data["data"] as? String{
        labelContent = data

Override willRevealOnInterface to retrive data from pop and Nav.dismiss operations.

override func willRevealOnInterface(with data: [String : Any]) {
    if let data = data["data"] as? String{
        label.text = data

Full list of operations:

  • push
  • pop
  • present
  • presentNav (viewControllers will be embeded in the type of UINavigationController specified)
  • dismiss (only available through SceneCoordinator<Nav>)
  • select (only available through SceneCoordinator<Tab>)


linhairui. Email: [email protected]


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

Latest podspec

    "name": "SceneCoordinator",
    "version": "0.1.2",
    "summary": "A convenient and simple way of navigating to and from ViewControllersn."",
    "description": "A convenient and simple way of navigating to and from ViewControllers. n  * Routern  * Coordinatorn  * Scenes",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "[email protected]": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.2"
    "platforms": {
        "ios": "10.0"
    "swift_version": "4.2",
    "source_files": "SceneCoordinator/Classes/**/*"

Pin It on Pinterest

Share This