title: Do you have to set translatesAutoresizingMaskIntoConstraints to false for a ViewController's 'main' view?
body: <p>I have a blank Swift project in Xcode and am not using storyboard.  I have a view that I've added in code under viewDidLoad:</p>
  <pre><code>var view1 = UIView()
  view1.backgroundColor = .red
  view.addSubview(view1)
  view1.translatesAutoresizingMaskIntoConstraints = false
  </code></pre>
  <p>I then add constraints:</p>
  <pre><code>NSLayoutConstraint.activate([
              view1.topAnchor.constraint(equalTo: view.topAnchor, constant: 20),
              view1.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 20),
              view1.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -20),
              view1.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -20)
          ])
  </code></pre>
  <p>The view loads and looks fine in the simulator.  But I've been having some issues with some other views in another project so I have built the above for testing.  So what I've discovered is that even though the above builds and works, if I check for ambiguous layouts using:</p>
  <pre><code>print(view1.hasAmbiguousLayout)
  </code></pre>
  <p>I get errors logged:</p>
  <blockquote>
  <p>2021-02-14 15:26:34.919048+1100 autolayoutextensions[6603:4438601]
  [LayoutConstraints] View has an ambiguous layout. See &quot;Auto Layout
  Guide: Ambiguous Layouts&quot; for help debugging. Displaying synopsis from
  invoking -[UIView _autolayoutTrace] to provide additional detail.</p>
  <p>*UIView:0x13360c3b0- AMBIGUOUS LAYOUT for UIView:0x13360c3b0.Width{id: 9}, UIView:0x13360c3b0.Height{id: 12}</p>
  <p>Legend:   * - is laid out with auto layout    + - is laid out manually,
  but is represented in the layout engine because
  translatesAutoresizingMaskIntoConstraints = YES   • - layout engine
  host true</p>
  </blockquote>
  <p>The only way I can get these errors to NOT get logged, is by also setting the ViewController's main view as follows:</p>
  <pre><code>view.translatesAutoresizingMaskIntoConstraints = false
  </code></pre>
  <p>By doing this, I know get the following log output:</p>
  <blockquote>
  <p>false</p>
  </blockquote>
  <p>So my question is this... I haven't read anywhere in Apple's documentation (or here, Googling etc) that says you have to set the viewController's <code>view.translatesAutoresizingMaskIntoConstraints</code> to <code>false</code>.  Have I missed something? Apologies if this is just my understanding but would be good to get this clarified.</p>