Here is my add code for this bar.
var searchBar = UISearchBar() searchBar.heightAnchor.constraint(equalToConstant: 44).isActive = true navigationItem.titleView = searchBar searchBar.heightAnchor.constraint (equalToConstant: 44) .isActive = true to prevent the bar from extending the navigationBar
On iOS 11.1, it looks like this
On iOS 11.3, it looks fine 
The question is how to get back to normal on iOS 11.1