title: NavigationItem TitleView constraint not working
body: <p>I want to create a search bar using UITextField. I tried to set NavigationItem's TitleView to the textfield and set corresponding constraints. But the textfield remain very short in the center of the navigation bar. How to make the textfield fill the whole navigation bar? Here is my code:</p>
  
  <pre><code>cancelbtn = UIBarButtonItem(title: "Cancel", style: .plain, target: self, action: #selector(CourseTableViewController.searchCancelled))
  self.navigationItem.leftBarButtonItem = cancelbtn
  
  let searchField = UITextField()
  searchField.translatesAutoresizingMaskIntoConstraints = false
  searchField.borderStyle = .roundedRect
  self.navigationItem.titleView = searchField
  self.navigationItem.titleView!.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: cancelbtn.width)
  self.navigationItem.titleView!.widthAnchor.constraint(equalToConstant: view.frame.size.width - cancelbtn.width)
  </code></pre>
  
  <p>And is how it looks rn:
  <a href="https://i.stack.imgur.com/No7iY.png" rel="nofollow noreferrer">UIView</a></p>