I'm adding a imageView and UISearchController.searchBar to tableView.tableHeaderView. but don't find the correct way to show the searchBar after the Image.
let view = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 333))
let image = UIImageView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 269))
image.image = #imageLiteral(resourceName: "map")
view.addSubview(image)
view.insertSubview(searchController.searchBar, at: 1)//insertSubview(searchController.searchBar, belowSubview: image)
self.tableView.tableHeaderView = view


If you want to add search bar at the bottom of your view You can add search bar programmatically and pin it to the bottom of your view
The simplest way