I want to add a UISearchBar to a UITableView that already has a header view. When I try and add the search bar to the existing header view it works until I tap on it, at which point I get The view hierarchy is not prepared for the constraint
, which appears to be because the search bar is not a direct subview of the tableview so when the UISearchController tries to update the constraints it can't.
The only way around this that I've found is making the table view header the search bar, then everything works fine, but of course then I lose the other views that were already in the header view.