 
 extension XCTableViewDataSource {
     public var router: Router {
-        guard let router = tableView?.viewController?.router else {
+        guard let tableView = tableView else {
+            return Router(navigationController: nil)
+        }
+
+        guard let router = tableView.viewController?.router else {
             #if DEBUG
             if isDebuggerAttached {
                 fatalError("Datasource doesn't have a view controller.")
             }
             #endif
-            return Router(viewController: UIViewController())
+            return Router(navigationController: nil)
         }
 
         return router


extension XCCollectionViewDataSource {
    public var router: Router {
        guard let router = collectionView?.viewController?.router else {
            #if DEBUG
            if isDebuggerAttached {
                fatalError("Datasource doesn't have a view controller.")
            }
            #endif
            return Router(viewController: UIViewController())
        }

        return router

}

private struct RouteHandlerAssociatedKey {
    static var navigationController = "navigationController"
}

extension RouteHandler {
    public var navigationController: UINavigationController? {
        return objc_getAssociatedObject(self, &RouteHandlerAssociatedKey.navigationController) as? UINavigationController
    }

    fileprivate func setNavigationController(_ navigationController: UINavigationController?) {
        objc_setAssociatedObject(self, &RouteHandlerAssociatedKey.navigationController, navigationController, .OBJC_ASSOCIATION_ASSIGN)
    }
}

