     }
 }
 
-extension UINavigationController {
-    
+extension UINavigationController
+{
     override open var preferredStatusBarStyle: UIStatusBarStyle {
         return topViewController?.preferredStatusBarStyle ?? .default
     }

        return true
    }
    
    
    
    public func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool {
            self.setNeedsNavigationBackground(color: self.topViewController?.navBarBgColor ?? UIColor.defaultNavBarBgColor)
        return true
    }
    
    //处理返回手势中断的情况
    private func dealInteractionChanges(_ context: UIViewControllerTransitionCoordinatorContext) {
        let animations: (UITransitionContextViewControllerKey) -> () = {
            let curColor = context.viewController(forKey: $0)?.navBarBgColor ?? UIColor.defaultNavBarBgColor
            self.setNeedsNavigationBackground(color: curColor)
        }
        
        //自动取消了返回手势
        if context.isCancelled {
            let cancelDuration: TimeInterval = context.transitionDuration * Double(context.percentComplete)
            UIView.animate(withDuration: cancelDuration) {
                animations(.from)
            }
        } else {
            //自动完成了返回手势
            let finishDuration: TimeInterval = context.transitionDuration * Double(1 - context.percentComplete)
            UIView.animate(withDuration: finishDuration) {

        }
        set {
            objc_setAssociatedObject(self, &AssociatedKeys.navBarBgColor, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
//            navigationController?.setNeedsNavigationBackground(color: navBarBgColor)
        }
    }
    
