         }
     }
 
-    override open func popViewController(animated: Bool) -> UIViewController {
+    override  func popViewController(animated: Bool) -> UIViewController {
         return SafeUnwrapViewController(controller: super.popViewController(animated: animated)!)
     }
     
-    override open func popToRootViewController(animated: Bool) -> [UIViewController]? {
+    override  func popToRootViewController(animated: Bool) -> [UIViewController]? {
         return super.popToRootViewController(animated: animated)!.map{ (viewController) -> UIViewController in
           SafeUnwrapViewController(controller: viewController)
         }
     }
 
-    override open func popToViewController(_ viewController: UIViewController, animated: Bool) -> [UIViewController] {
+    override  func popToViewController(_ viewController: UIViewController, animated: Bool) -> [UIViewController]? {
         var controllerToPop: UIViewController? = nil
         for item in super.viewControllers {
             if SafeUnwrapViewController(controller: item) == viewController {

        super.setViewControllers(vcs, animated: animated)
    }
    
    override open var delegate: UINavigationControllerDelegate? {
        didSet {
            self.rt_delegate = delegate
        }
    }
//
//    func shouldAutorotate(to toInterfaceOrientation: UIInterfaceOrientation) -> Bool {
//        return self.topViewController!.shouldAutorotate(to: toInterfaceOrientation)
//    }
    
    override open var shouldAutorotate: Bool {
        return self.topViewController?.shouldAutorotate ?? false
    }

    override open var supportedInterfaceOrientations: UIInterfaceOrientationMask {
        return self.topViewController?.supportedInterfaceOrientations ?? .portrait
    }

    override open var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
         return self.topViewController?.preferredInterfaceOrientationForPresentation ?? .unknown
    }

    @available(iOS, introduced: 2.0, deprecated: 8.0, message: "Header views are animated along with the rest of the view hierarchy")
    override open func rotatingHeaderView() -> UIView? {
        return self.topViewController!.rotatingHeaderView()!
    }
    
    @available(iOS, introduced: 2.0, deprecated: 8.0, message: "Footer views are animated along with the rest of the view hierarchy")
    override open func rotatingFooterView() -> UIView? {
        return self.topViewController!.rotatingFooterView()!
    }
    
    override open func responds(to aSelector: Selector) -> Bool {
        if super.responds(to: aSelector) {
            return true
        }

        return self.rt_delegate?.responds(to: aSelector) ?? false
    }

    override  func forwardingTarget(for aSelector: Selector) -> Any? {
        return self.rt_delegate
    }
    
     func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
        var viewController = viewController
        let isRootVC = viewController == navigationController.viewControllers.first!
        if !isRootVC {
            viewController = SafeUnwrapViewController(controller: viewController)
            if !self.useSystemBackBarButtonItem && viewController.navigationItem.leftBarButtonItem == nil {
                viewController.navigationItem.leftBarButtonItem = viewController.customBackItem(withTarget: self, action: #selector(self.onBack))
            }
        }
        
        self.rt_delegate?.navigationController!(navigationController, willShow: viewController, animated: animated)
    }
    
     func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
        var viewController = viewController
        let isRootVC = viewController == navigationController.viewControllers.first!
        viewController = SafeUnwrapViewController(controller: viewController)
        if viewController.disableInteractivePopGesture {
            self.interactivePopGestureRecognizer?.delegate = nil
            self.interactivePopGestureRecognizer?.isEnabled = false
        } else {
            self.interactivePopGestureRecognizer?.delaysTouchesBegan = true
            self.interactivePopGestureRecognizer?.delegate = self
            self.interactivePopGestureRecognizer?.isEnabled = !isRootVC
