I am experiencing a problem with the new way of adding search bar to the navigation item.
As you can see in the picture below, there are two UIViewControllers one af
In the VC1:
override func viewDidLoad() {
if #available(iOS 11.0, *) {
navigationItem.hidesSearchBarWhenScrolling = false
navigationItem.searchController = searchController
}
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if #available(iOS 11.0, *) {
navigationItem.hidesSearchBarWhenScrolling = true
}
}
In the VC2, use the same code.
This will solve your problem more clearly, than set serchController to nil