      */
     
     @objc func didUpdateText(_ sender: AnyObject) {
-        let newHeight = heightForCurrentText()
-        if let maxHeight = maxHeight, newHeight > maxHeight {
-            isScrollEnabled = true
-            showsVerticalScrollIndicator = true
-            return
+        var newHeight = heightForCurrentText()
+        
+        if let maxHeight = maxHeight, newHeight >= maxHeight {
+            newHeight = maxHeight
+            isMaxHeight = true
+        } else {
+            if let minHeight = minHeight, newHeight < minHeight {
+                newHeight = minHeight
+            }
+            isMaxHeight = false
         }
+        
         if newHeight != heightConstraint.constant {
             updateHeightConstraint(newHeight)
         }

    /// The duration of the animation while resizing the text view in seconds. Defaults to `0.1`.
    public var resizeDuration: TimeInterval = 0.1
    
    private var heightConstraint: NSLayoutConstraint!
    
    private var maxHeight: CGFloat?
    
    public var resizeForNumberOfLines: Int = 0 {
        didSet {
            guard resizeForNumberOfLines > 0 else { return (maxHeight = nil) }
            let padding = (textContainer.lineFragmentPadding * 2) + textContainerInset.top + textContainerInset.bottom
            maxHeight = (font!.lineHeight * CGFloat(resizeForNumberOfLines)) + padding
        }
    }
    
    /// This closure will be called before the text view's `height` is changed.
    /// The parameter is the height that the text view will be updated to as a `CGFloat`.

 A `UITextView` subclass that automatically resizes based on the size of its content text with a smooth animation.
 */
open class ResizingTextView: UITextView {
    
    public enum ResizableHeight {
        case height(CGFloat)
        case numberOfLines(Int)
        case infinite
    }
    
    /*
     *  MARK: - Instance Properties
