Your third method is almost perfect for doing what you want, all you have to do is add searchController.searchBar as the subview view, not the view itself.
let searchController = UISearchController(searchResultsController: searchResultsController) searchBarContainer.addSubview(searchController.searchBar)
* searchBarContainer - Your opinion in the storyboard.
This code is kindly provided by mylovemhz, which answered a similar question at this link: Can I use UISearchController with a storyboard?
By sending it here for those who come to this topic when searching.
source share