title: How to resolve "API error: returned 0 width, assuming UIViewNoIntrinsicMetric" when sizing inputAccessoryView?
body: <p>I pasted the code sample from here: <a href="https://stackoverflow.com/a/46510833/784637">https://stackoverflow.com/a/46510833/784637</a> into a new Single View App to pin <code>inputAccessoryView</code> at the bottom of the screen:</p>
  
  <pre><code>
  class ViewController: UIViewController {
  
      override var canBecomeFirstResponder: Bool { return true }
  
      var _inputAccessoryView: UIView!
  
      override var inputAccessoryView: UIView? {
  
          if _inputAccessoryView == nil {
  
              _inputAccessoryView = CustomView()
              _inputAccessoryView.backgroundColor = UIColor.groupTableViewBackground
  
              let textField = UITextField()
              textField.borderStyle = .roundedRect
  
              _inputAccessoryView.addSubview(textField)
  
              _inputAccessoryView.autoresizingMask = .flexibleHeight
  
              textField.translatesAutoresizingMaskIntoConstraints = false
  
              textField.leadingAnchor.constraint(
                  equalTo: _inputAccessoryView.leadingAnchor,
                  constant: 8
              ).isActive = true
  
              textField.trailingAnchor.constraint(
                  equalTo: _inputAccessoryView.trailingAnchor,
                  constant: -8
              ).isActive = true
  
              textField.topAnchor.constraint(
                  equalTo: _inputAccessoryView.topAnchor,
                  constant: 8
              ).isActive = true
  
              // this is the important part :
  
              textField.bottomAnchor.constraint(
                  equalTo: _inputAccessoryView.layoutMarginsGuide.bottomAnchor,
                  constant: -8
              ).isActive = true
          }
  
          return _inputAccessoryView
      }
  
      override func loadView() {
  
          let tableView = UITableView()
          tableView.keyboardDismissMode = .interactive
  
          view = tableView
      }
  }
  
  class CustomView: UIView {
  
      // this is needed so that the inputAccesoryView is properly sized from the auto layout constraints
      // actual value is not important
  
      override var intrinsicContentSize: CGSize {
          return CGSize.zero
      }
  }
  </code></pre>
  
  <p>When I run the simulator everything looks great, however the console reports this error when I tap on the UITextField:</p>
  
  <pre><code>API error: &lt;_UIKBCompatInputView: 0x7fc725f20520; frame = (0 0; 0 0); layer = &lt;CALayer: 0x60000232e6c0&gt;&gt; returned 0 width, assuming UIViewNoIntrinsicMetric
  </code></pre>
  
  <p>I've tried overriding <code>intrinsicContentSize</code> to a non-zero value like <code>CGSize(width: 50, height: 50)</code> but am still getting this error.  How can I resolve this?</p>