title: swift not sure on layoutIfNeeded setNeedsUpdateConstraints or updateConstraints setNeedsLayout
body: <p>I am calling an API. Depending on what json data I get back I am modyfing my View Controller in <code>viewDidLoad()</code> in order to change my views design to display the given data best way possible.</p>
  
  <p>What I do is to hide some uiViews and set their constraints to be .active = false but also changing some of the constraint by eg:</p>
  
  <pre><code>let noCButton = NSLayoutConstraint(item: aListTop, attribute: NSLayoutAttribute.CenterY, relatedBy: NSLayoutRelation.Equal, toItem: aListBottom, attribute: NSLayoutAttribute.CenterY, multiplier: 1, constant: 0)
          view.addConstraint(noBidButton)
  </code></pre>
  
  <p>Then just before closing viewDidLoad() where I change/disable some constraints I call <code>view.layoutIfNeeded()</code></p>
  
  <p>So my question now is,</p>
  
  <p>If I change/disable some constraints or hide a uiview, should I always call <code>view.layoutIfNeeded()</code> afterwards?</p>
  
  <p>Also, do I need to call <code>view.layoutIfNeeded()</code> right after every change or can I just simply call it once before closing viewDidLoad()?</p>
  
  <p>I dont get any errors in my console either way, but I just want to make sure I am doing it the right way. I also noted functions like <code>updateConstraints</code> but layoutIfNeeded seems to work, tho im not 100% sure about the difference</p>
  
  <p>Thanks in advance, </p>