             
             normalX?.isActive = false
             normalX = nil
-            
             scaledX?.isActive = false
             scaledX = nil
         }
-        
-        func clearVerticalConstraints() {
-            
-            normalY?.isActive = false
-            normalY = nil
-            
-            scaledY?.isActive = false
-            scaledY = nil
-        }
+    }
+    
+    /// If `true`, the next invocation of `updateConstraints` updates the existing horizontal placeholder constraints.
+    private var needsUpdateOfHorizontalPlaceholderConstraints = false
+    
+    private func setNeedsUpdateHorizontalPlaceholderConstraints() {
+        
+        needsUpdateOfHorizontalPlaceholderConstraints = true
+        setNeedsUpdateConstraints()
+    }
+    
+    /// If `true`, the next invocation of `updateConstraints` updates the existing vertical placeholder constraints.
+    private var needsUpdateOfVerticalPlaceholderConstraints = false
+    
+    private func setNeedsUpdateVerticalPlaceholderConstraints() {
+        
+        needsUpdateOfVerticalPlaceholderConstraints = true
+        setNeedsUpdateConstraints()
     }
     
     /// The font of the text field.

    open var placeholderMode: RAGTextFieldPlaceholderMode = .scalesWhenNotEmpty {
        didSet {
            invalidateIntrinsicContentSize()
            placeholderConstraints.clearVerticalConstraints()
            setNeedsUpdateConstraints()
        }
    }
    

        if placeholderConstraints.normalX == nil {
            placeholderConstraints.normalX = makeNormalHorizontalPlaceholderConstraint(textAlignment: textAlignment)
            placeholderConstraints.normalX?.isActive = !isPlaceholderTransformedToScaledPosition
        } else if needsUpdateOfHorizontalPlaceholderConstraints {
            placeholderConstraints.normalX?.constant = normalHorizontalPlaceholderConstraintConstant(for: textAlignment)
            placeholderConstraints.normalX?.isActive = !isPlaceholderTransformedToScaledPosition
        }
        
        if placeholderConstraints.normalY == nil {
            placeholderConstraints.normalY = makeNormalVerticalPlaceholderConstraint()
            placeholderConstraints.normalY?.isActive = !isPlaceholderTransformedToScaledPosition
        } else if needsUpdateOfVerticalPlaceholderConstraints {
            placeholderConstraints.normalY?.constant = normalVerticalPlaceholderConstraintConstant()
            placeholderConstraints.normalY?.isActive = !isPlaceholderTransformedToScaledPosition
        }
        
        if placeholderConstraints.scaledX == nil {
            placeholderConstraints.scaledX = makeScaledHorizontalPlaceholderConstraint(textAlignment: textAlignment)
            placeholderConstraints.scaledX?.isActive = isPlaceholderTransformedToScaledPosition
        } else if needsUpdateOfHorizontalPlaceholderConstraints {
            placeholderConstraints.scaledX?.constant = scaledHorizontalPlaceholderConstraintConstant(for: textAlignment)
            placeholderConstraints.scaledX?.isActive = isPlaceholderTransformedToScaledPosition
        }
        
        if placeholderConstraints.scaledY == nil {
            placeholderConstraints.scaledY = makeScaledVerticalPlaceholderConstraint()
            placeholderConstraints.scaledY?.isActive = isPlaceholderTransformedToScaledPosition
        } else if needsUpdateOfVerticalPlaceholderConstraints {
            placeholderConstraints.scaledY?.constant = scaledVerticalPlaceholderConstraintConstant()
            placeholderConstraints.scaledY?.isActive = isPlaceholderTransformedToScaledPosition
        }
        
        needsUpdateOfHorizontalPlaceholderConstraints = false
        needsUpdateOfVerticalPlaceholderConstraints = false
        
        super.updateConstraints()
    }
