I have a problem: I have a UIView that contains a UISearchBar as a header of a UITableView. The problem is that whenever I tap on the UISearchBar, the animated scope buttons come out hiding part of the first row of the table. I looked at a lot of similar questions but none of the answers worked. Is there a way to add a bottom constraint to the headerView so that the UITableView goes down of the height of the scope buttons view whenever the UISearchBar is focused and being edited?
This is the code where I add the UISearchController:
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = false
definesPresentationContext = true
searchController.searchBar.scopeButtonTitles = ["Groups", "People"]
tableView.tableHeaderView = searchController.searchBar
searchController.searchBar.delegate = self
searchController.searchBar.sizeToFit()
searchController.searchBar.barTintColor = darkGreen
searchController.searchBar.tintColor = yellow
searchController.searchBar.backgroundColor = darkGreen
tableView.sectionHeaderHeight = UITableViewAutomaticDimension
If you could please let me know how could I fix this bug I would really appreciate it!
Thanks!

