     private var isObserving: Bool = false
     private var isAdjustSafeAreaInset: Bool = false
  
+    private let keyboardWillChangeFrame: Notification.Name = {
+        #if swift(>=4.2)
+        return UIResponder.keyboardWillChangeFrameNotification
+        #else
+        return NSNotification.Name.UIKeyboardWillChangeFrame
+        #endif
+    }()
+    
+    private let keyboardWillHide: Notification.Name = {
+        #if swift(>=4.2)
+        return UIResponder.keyboardWillHideNotification
+        #else
+        return NSNotification.Name.UIKeyboardWillHide
+        #endif
+    }()
+    
     convenience public init(with adjustSafeAreaInset: Bool) {
         self.init()
         self.isAdjustSafeAreaInset = adjustSafeAreaInset

        guard !isObserving else { return }
        
        isObserving = true
        NotificationCenter.default.addObserver(self, selector: #selector(onKeyboardHandler(_:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
        NotificationCenter.default.addObserver(self, selector: #selector(onKeyboardHandler(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
        
        panGesture = UIPanGestureRecognizer(target: self, action: #selector(onPan(_:)))
        panGesture?.delegate = self

    
    // MARK: - Action
    @objc func onKeyboardHandler(_ noti: Notification) {
        #if swift(>=4.2)
        let keyboardFrameEndKey = UIResponder.keyboardFrameEndUserInfoKey
        #else
        let keyboardFrameEndKey = UIKeyboardFrameEndUserInfoKey
        #endif
        
        guard let rect = (noti.userInfo?[keyboardFrameEndKey] as? NSValue)?.cgRectValue else { return }
        
        var newFrame = rect
        
        switch noti.name {
        case keyboardWillChangeFrame:
            if rect.origin.y < 0 {
                newFrame.origin.y = screenHeight - newFrame.height
            }
        case keyboardWillHide:
            if rect.minY < 0.0 {
                newFrame.origin.y = screenHeight
            }
