title: Change relation of NSLayoutConstraint programmatically in iOS
body: <p>I have a <code>UITextView</code> at the bottom of screen.<br>
  It has <code>leading, trailing bottom space constraints to the superview</code>.<br>
  It has also <code>height constraint with value (constant) 40</code>.  </p>
  
  <p>I want to make this text view of flexible height as I go on typing more text in it.
  I can make flexible height by changing height constraint value to <code>greater than or equal</code> to as:</p>
  
  <p><a href="https://i.stack.imgur.com/AwDw5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AwDw5.png" alt="enter image description here"></a></p>
  
  <p>It works fine and text view height goes on increasing.</p>
  
  <p>But when I make it, storyboard show this error:</p>
  
  <p><a href="https://i.stack.imgur.com/MJwnb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MJwnb.png" alt="enter image description here"></a></p>
  
  <p>I want to make constraint value greater than or equal to programmatically, not from storyboard.  </p>
  
  <p>I know that there is one property of <code>NSLayoutConstraint</code> called </p>
  
  <pre><code>public var relation: NSLayoutRelation { get }
  </code></pre>
  
  <p>but as we can see it is readonly.</p>
  
  <p>How can I change this relation to one of:</p>
  
  <pre><code>public enum NSLayoutRelation : Int {   
      case LessThanOrEqual
      case Equal
      case GreaterThanOrEqual
  }
  </code></pre>
  
  <p>Or is there any workaround make a view of flexible height in auto-layout based storyboard?</p>
  
  <hr>
  
  <p>I know about making IBOutlet of constraint and changing it’s constant value, but in my situation I can not do this, it should be changed dynamically. </p>