         identifier: String?,
         to containerView: UIView?,
         configure: ((T) -> Void)?) -> T?
-}
-
-public extension Routable where Self: UIViewController, StoryboardIdentifier.RawValue == String {
-    
-    /// Presents the intial view controller of the specified storyboard modally.
-    ///
-    ///     class ViewController: UIViewController {
-    ///
-    ///         @IBAction func moreTapped() {
-    ///             present(storyboard: .more) { (controller: MoreViewController) in
-    ///                 controller.someProperty = "\(Date())"
-    ///             }
-    ///         }
-    ///     }
-    ///
-    ///     extension ViewController: Routable {
-    ///
-    ///         enum StoryboardIdentifier: String {
-    ///             case more = "More"
-    ///             case login = "Login"
-    ///         }
-    ///     }
-    ///
-    /// - Parameters:
-    ///   - storyboard: Storyboard name.
-    ///   - bundle: Bundle of the storyboard.
-    ///   - identifier: Storyboard identifier.
+    
+    /// Dismisses or pops the view controller that was presented.
+    ///
+    /// - Parameters:
     ///   - animated: Pass true to animate the presentation; otherwise, pass false.
-    ///   - modalPresentationStyle: The presentation style for modally presented view controllers.
-    ///   - modalTransitionStyle: The transition style to use when presenting the view controller.
-    ///   - configure: Configure the view controller before it is loaded.
-    ///   - completion: Completion the view controller after it is loaded.
-    /// - Returns: Returns the view controller instance from the storyboard.
-    func present<T: UIViewController>(
-        storyboard: StoryboardIdentifier,
-        inBundle bundle: Bundle? = nil,
-        identifier: String? = nil,
-        animated: Bool = true,
-        modalPresentationStyle: UIModalPresentationStyle? = nil,
-        modalTransitionStyle: UIModalTransitionStyle? = nil,
-        configure: ((T) -> Void)? = nil,
-        completion: ((T) -> Void)? = nil) -> T?
-    {
-        return RoutingLogic.present(
-            delegate: self,
-            storyboard: storyboard.rawValue,
-            inBundle: bundle,
-            identifier: identifier,
-            animated: animated,
-            modalPresentationStyle:
-            modalPresentationStyle,
-            modalTransitionStyle:
-            modalTransitionStyle,
-            configure: configure,
-            completion: completion
-        )
-    }
-    
-    /// Present the intial view controller of the specified storyboard in the primary context.
-    /// Set the initial view controller in the target storyboard or specify the identifier.
-    ///
-    ///     class ViewController: UIViewController {
-    ///
-    ///         @IBAction func moreTapped() {
-    ///             show(storyboard: .more) { (controller: MoreViewController) in
-    ///                 controller.someProperty = "\(Date())"
-    ///             }
-    ///         }
-    ///     }
-    ///
-    ///     extension ViewController: Routable {
-    ///
-    ///         enum StoryboardIdentifier: String {
-    ///             case more = "More"
-    ///             case login = "Login"
-    ///         }
-    ///     }
-    ///
-    /// - Parameters:
-    ///   - storyboard: Storyboard name.
-    ///   - bundle: Bundle of the storyboard.
-    ///   - identifier: Storyboard identifier.
-    ///   - configure: Configure the view controller before it is loaded.
-    /// - Returns: Returns the view controller instance from the storyboard.
-    func show<T: UIViewController>(
-        storyboard: StoryboardIdentifier,
-        inBundle bundle: Bundle? = nil,
-        identifier: String? = nil,
-        configure: ((T) -> Void)? = nil) -> T?
-    {
-        return RoutingLogic.show(
-            delegate: self,
-            storyboard: storyboard.rawValue,
-            inBundle: bundle,
-            identifier: identifier,
-            configure: configure
-        )
-    }
-    
-    /// Present the intial view controller of the specified storyboard in the secondary (or detail) context.
-    /// Set the initial view controller in the target storyboard or specify the identifier.
-    ///
-    /// - Parameters:
-    ///   - storyboard: Storyboard name.
-    ///   - bundle: Bundle of the storyboard.
-    ///   - identifier: Storyboard identifier.
-    ///   - configure: Configure the view controller before it is loaded.
-    /// - Returns: Returns the view controller instance from the storyboard.
-    func showDetailViewController<T: UIViewController>(
-        storyboard: StoryboardIdentifier,
-        inBundle bundle: Bundle? = nil,
-        identifier: String? = nil,
-        configure: ((T) -> Void)? = nil) -> T?
-    {
-        return RoutingLogic.showDetailViewController(
-            delegate: self,
-            storyboard: storyboard.rawValue,
-            inBundle: bundle,
-            identifier: identifier,
-            configure: configure
-        )
-    }
-}
-
-/// Conforming types can use a weak `UIViewController` instance.
-public protocol Router {
-    var viewController: UIViewController? { get set }
-    
-    @discardableResult
-    func present<T: UIViewController>(
-        storyboard: String,
-        inBundle bundle: Bundle?,
-        identifier: String?,
-        animated: Bool,
-        modalPresentationStyle: UIModalPresentationStyle?,
-        modalTransitionStyle: UIModalTransitionStyle?,
-        configure: ((T) -> Void)?,
-        completion: ((T) -> Void)?) -> T?
-    
-    @discardableResult
-    func show<T: UIViewController>(
-        storyboard: String,
-        inBundle bundle: Bundle?,
-        identifier: String?,
-        configure: ((T) -> Void)?) -> T?
-    
-    @discardableResult
-    func showDetailViewController<T: UIViewController>(
-        storyboard: String,
-        inBundle bundle: Bundle?,
-        identifier: String?,
-        configure: ((T) -> Void)?) -> T?
-    
+    ///   - completion: The block to execute after the view controller is dismissed.
     func dismiss(animated: Bool, completion: (() -> Void)?)
 }
 
 public extension Router {
     
-    /// Presents the intial view controller of the specified storyboard modally.
-    ///
-    /// - Parameters:
-    ///   - storyboard: Storyboard name.
-    ///   - bundle: Bundle of the storyboard.
-    ///   - identifier: Storyboard identifier.
-    ///   - animated: Pass true to animate the presentation; otherwise, pass false.
-    ///   - modalPresentationStyle: The presentation style for modally presented view controllers.
-    ///   - modalTransitionStyle: The transition style to use when presenting the view controller.
-    ///   - configure: Configure the view controller before it is loaded.
-    ///   - completion: Completion the view controller after it is loaded.
-    /// - Returns: Returns the view controller instance from the storyboard.
     func present<T: UIViewController>(
         storyboard: String,
         inBundle bundle: Bundle? = nil,

        configure: ((T) -> Void)?,
        completion: ((T) -> Void)?) -> T?
    
    @discardableResult
    func show<T: UIViewController>(
        storyboard: StoryboardIdentifier,
        inBundle bundle: Bundle?,
        identifier: String?,
        configure: ((T) -> Void)?) -> T?
    
    @discardableResult
    func showDetailViewController<T: UIViewController>(
        storyboard: StoryboardIdentifier,
        inBundle bundle: Bundle?,
        identifier: String?,
        configure: ((T) -> Void)?) -> T?
    
    @discardableResult
    func add<T: UIViewController>(
        child storyboard: String,

//
//  Created by Basem Emara on 4/26/17.
//  Copyright © 2017 Zamzam. All rights reserved.
//  http://basememara.com/protocol-oriented-router-in-swift/
//

import UIKit

/// Provides routing functionality for a type to remove navigation responsibility off `UIViewController`.
///
///     struct MyRouter: Router {
///         weak var viewController: UIViewController?
///
///         init(viewController: UIViewController?) {
///             self.viewController = viewController
///         }
///
///         func showSettings(date: Date) {
///             present(storyboard: "ShowSettings") { (controller: ShowSettingsViewController) in
///                 controller.someProperty = date
///             }
///         }
///     }
///
///     class MyViewController: UIViewController {
///
///         private lazy var router: Router = MyRouter(
///             viewController: self
///         )
///
///         @IBAction func settingsTapped() {
///             router.showSettings(date: Date())
///         }
///     }
///
/// Conforming types should use a weak `UIViewController` instance.
public protocol Router {
    var viewController: UIViewController? { get set }
    
    /// Presents a view controller from the specified storyboard modally.
    ///
    ///     present(storyboard: "ShowSettings") { (controller: ShowSettingsViewController) in
    ///         controller.someProperty = "Abc"
    ///     }
    ///
    /// Set the initial view controller in the target storyboard or specify the identifier.
    ///
    /// - Parameters:
    ///   - storyboard: Storyboard name.
    ///   - bundle: Bundle of the storyboard.
    ///   - identifier: Storyboard identifier.
    ///   - animated: Pass true to animate the presentation; otherwise, pass false.
    ///   - modalPresentationStyle: The presentation style for modally presented view controllers.
    ///   - modalTransitionStyle: The transition style to use when presenting the view controller.
    ///   - configure: Configure the view controller before it is loaded.
    ///   - completion: Completion the view controller after it is loaded.
    /// - Returns: Returns the view controller instance from the storyboard.
    @discardableResult
    func present<T: UIViewController>(
        storyboard: String,
        inBundle bundle: Bundle?,
        identifier: String?,
        animated: Bool,
