title: How can I change constraints priority in run time
body: <p>I have a view which has dynamic height and I am trying to change this view height priority in run time.</p>
  
  <p>Here is my part of code;</p>
  
  <pre><code>if (index == 0) {
  
      surveyViewHeightConstraint.constant = 0;
      surveyViewHeightConstraint.priority = 1000;
  
  } else if (index == 1) {
  
      surveyViewHeightConstraint.constant = 163;
      surveyViewHeightConstraint.priority = 500;
  
  }
  </code></pre>
  
  <p>I am changing index with a button action. When I run this code, I am getting this error:</p>
  
  <pre><code>*** Assertion failure in -[NSLayoutConstraint setPriority:], /SourceCache/Foundation/Foundation-1141.1/Layout.subproj/NSLayoutConstraint.m:174
  </code></pre>
  
  <p>What is my mistake in here?</p>