      Call this function from `keyboardWillHide` in order to have the constraint constant reset back to zero.
      */
     public func keyboardWillDisappear(constraint: NSLayoutConstraint? = nil) {
+        setConstant(of: constraint, to: 0, animated: true)
+    }
+    
+    func setConstant(of constraint: NSLayoutConstraint?, to constant: CGFloat, animated: Bool = false, duration: TimeInterval = 0.3, curve: UIViewAnimationOptions? = nil) {
+        if animated {
+            UIView.animate(withDuration: duration, delay: 0.0, usingSpringWithDamping: 1.0, initialSpringVelocity: 1.0, options: [curve ?? .curveEaseInOut], animations: {
+                self.finishSettingConstant(of: constraint, to: constant)
+            }, completion: nil)
+        } else {
+            finishSettingConstant(of: constraint, to: constant)
+        }
+    }
+    
+    func finishSettingConstant(of constraint: NSLayoutConstraint?, to constant: CGFloat) {
         if let constraint = constraint {
-            constraint.constant = 0
+            constraint.constant = constant
         } else {
-            constraintToAdjust?.constant = 0
+            constraintToAdjust?.constant = constant
         }
+        view.layoutIfNeeded()
     }
 
 }

        if modalPresentationStyle == .formSheet || navigationController?.modalPresentationStyle == .formSheet {
            maxY = wrapper.frame.height + statusBarHeight
        }
        let offset = maxY - keyboardFrame.origin.y
        return max(offset, 0)
    }

       (`UIApplication.shared.statusBarFrame.height`). Used for form sheet modals.
     */
    public func adjustConstraint(for keyboardFrame: CGRect, constraint: NSLayoutConstraint? = nil, statusBarHeight: CGFloat = 0.0) {
        guard keyboardFrame.height > 0 else { setConstant(of: constraint, to: 0); return }
        let adjustedConstant = self.adjustedConstant(for: keyboardFrame, statusBarHeight: statusBarHeight)
        setConstant(of: constraint, to: adjustedConstant)
    }
    
    func adjustedConstant(for keyboardFrame: CGRect, statusBarHeight: CGFloat = 0.0) -> CGFloat {
