I've implemented UISearchController for ViewController with tableView on it and now I'm facing a problem of strange scrolling behavior of tableView. After scrolling tableView down and tapping status bar to scroll back to the top tableView isn't returning to its proper position (right under navigation bar). Looks like it stops its bounce back animation halfway. It goes back to the top if you touch the tableView after that though. Take a look at this gif to see it yourself.
The problem remains on a simulator and on a real device as well (iPhone7)
This is a code I setup searchController with:
class MyViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UISearchResultsUpdating {
@IBOutlet weak var tableView: UITableView!
var searchController = UISearchController(searchResultsController: nil)
override func viewDidLoad() {
searchController.searchResultsUpdater = self
searchController.obscuresBackgroundDuringPresentation = false
searchController.searchBar.placeholder = "Search..."
navigationItem.searchController = searchController
definesPresentationContext = true
}
...
}
What might cause such behavior and how to fix this?