title: How can I set priority on constraints in Swift?
body: <p>I've been struggling to make priority on constraints work programmatically in Swift.</p>
  <p>My goal is to have the <code>meetingFormView</code> no more than 300 wide. Using IB I would give the width constraint a lower priority and give a higher priority to the &quot;lessThanOrEqualToConstant&quot;. But I can't get it to work.</p>
  <p>I've tried this:</p>
  <pre><code>meetingFormView.translatesAutoresizingMaskIntoConstraints = false
  
  let constraintWidth = NSLayoutConstraint(
          item: meetingFormView,
          attribute: NSLayoutAttribute.width,
          relatedBy: NSLayoutRelation.equal,
          toItem: startView,
          attribute: NSLayoutAttribute.width,
          multiplier: 1,
          constant: 0)
  constraintWidth.priority = .defaultHigh
  
  NSLayoutConstraint.activate([
      meetingFormView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20),
      meetingFormView.heightAnchor.constraint(equalToConstant: 170),
      meetingFormView.widthAnchor.constraint(lessThanOrEqualToConstant: 300),
      meetingFormView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
      constraintWidth
  ])
  </code></pre>