Skip to content

Instantly share code, notes, and snippets.

@caldofran
Last active March 6, 2020 15:14
Show Gist options
  • Save caldofran/f8b346eb9146efcfd4839eab66fc56c1 to your computer and use it in GitHub Desktop.
Save caldofran/f8b346eb9146efcfd4839eab66fc56c1 to your computer and use it in GitHub Desktop.

Revisions

  1. caldofran revised this gist Mar 6, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions navigator.swift
    Original file line number Diff line number Diff line change
    @@ -3,11 +3,13 @@ class Navigator {
    switch navigation {
    case .section(let section):
    tabBarController().selectedIndex = section.rawValue

    case .modal(let screen):
    topMostViewController().present(
    screen.viewController(),
    animated: animated
    )

    case .push(let screen):
    currentNavigationController().pushViewController(
    screen.viewController(),
  2. caldofran revised this gist Mar 3, 2020. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions navigator.swift
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,15 @@ class Navigator {
    case .section(let section):
    tabBarController().selectedIndex = section.rawValue
    case .modal(let screen):
    topMostViewController().present(screen.viewController(), animated: animated)
    topMostViewController().present(
    screen.viewController(),
    animated: animated
    )
    case .push(let screen):
    currentNavigationController().pushViewController(screen.viewController(), animated: animated)
    currentNavigationController().pushViewController(
    screen.viewController(),
    animated: animated
    )
    }
    }
    }
  3. caldofran revised this gist Mar 3, 2020. 1 changed file with 3 additions and 6 deletions.
    9 changes: 3 additions & 6 deletions navigator.swift
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,12 @@
    class Navigator {
    var tabBarController: UITabBarController!
    var navigationController: UINavigationController!

    func handle(navigation: Navigation, animated: Bool = true) {
    switch navigation {
    case .section(let section):
    tabBarController.selectedIndex = section.rawValue
    tabBarController().selectedIndex = section.rawValue
    case .modal(let screen):
    tabBarController.present(screen.viewController(), animated: animated)
    topMostViewController().present(screen.viewController(), animated: animated)
    case .push(let screen):
    navigationController.pushViewController(screen.viewController(), animated: animated)
    currentNavigationController().pushViewController(screen.viewController(), animated: animated)
    }
    }
    }
  4. caldofran revised this gist Nov 20, 2019. No changes.
  5. caldofran created this gist Nov 20, 2019.
    15 changes: 15 additions & 0 deletions navigator.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    class Navigator {
    var tabBarController: UITabBarController!
    var navigationController: UINavigationController!

    func handle(navigation: Navigation, animated: Bool = true) {
    switch navigation {
    case .section(let section):
    tabBarController.selectedIndex = section.rawValue
    case .modal(let screen):
    tabBarController.present(screen.viewController(), animated: animated)
    case .push(let screen):
    navigationController.pushViewController(screen.viewController(), animated: animated)
    }
    }
    }