         }
         view.layoutIfNeeded()
     }
+    
+    func adjustBottomInsets(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.finishAdjustingBottomInsets(to: constant)
+            }, completion: nil)
+        } else {
+            finishAdjustingBottomInsets(to: constant)
+        }
+    }
+    
+    func finishAdjustingBottomInsets(to constant: CGFloat) {
+        if let scrollView = scrollViewToAdjust {
+            scrollView.contentInset.bottom = constant
+            scrollView.scrollIndicatorInsets.bottom = constant
+        }
+    }
 
 }

        return max(offset, 0)
    }
    
    /**
     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) {

        let adjustedConstant = self.adjustedConstant(for: keyboardFrame, statusBarHeight: statusBarHeight)
        let curve = UIViewAnimationOptions(rawValue: curveInt)
        setConstant(of: constraint, to: adjustedConstant, animated: true, duration: duration, curve: curve)
        let adjustedInset = self.adjustedInset(for: keyboardFrame, statusBarHeight: statusBarHeight)
        adjustBottomInsets(to: adjustedInset, animated: true, duration: duration, curve: curve)
    }
    
    /**
