     }
 
     // Safe area (for any iOS version)
+    private var _previousSafeAreaInsets: UIEdgeInsets = .zero
     private var safeAreaInsets: UIEdgeInsets {
         #if swift(>=3.2)
             if #available(iOS 11.0, *), let viewController = _view?.viewController {

            NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryChanged), name: .UIContentSizeCategoryDidChange, object: nil)
        }
        if !_observingFrame {
            addObserver(self, forKeyPath: "_view.frame", options: [.new], context: nil)
            addObserver(self, forKeyPath: "_view.bounds", options: [.new], context: nil)
            _observingFrame = true
        }
        if _observingInsets, viewControllerClass == nil {
            _stopObservingInsets()
        } else if #available(iOS 11.0, *), !_observingInsets, viewControllerClass != nil {
            addObserver(self, forKeyPath: "_view.safeAreaInsets", options: [.new], context: nil)
            _observingInsets = true
        }
    }

    }

    private var _observingInsets = false
    private var _shouldObserveInsets: Bool {
        guard let viewControllerClass = viewControllerClass else {
            return false
        }
        return !(viewControllerClass is UITabBarController.Type) &&
            !(viewControllerClass is UINavigationController.Type)
    }
    private func _stopObservingInsets() {
        if #available(iOS 11.0, *), _observingInsets {
            removeObserver(self, forKeyPath: "_view.safeAreaInsets")
