I have configured a UISearchController
as follows within viewDidLoad()
:
let searchController = UISearchController(searchResultsController: nil);
searchController.delegate = self;
searchController.searchResultsUpdater = self;
searchController.searchBar.delegate = self;
self.searchController.isActive = true;
self.searchController.searchBar.becomeFirstResponder();
self.navigationItem.searchController = searchController;
Although I have set isActive
and set the searchBar
as the firstResponder
, the UISearchController is not active when the view appears on the screen. Manually tapping on the field opens it correctly.
Is there a reason in iOS 12 that the isActive
and becomeFirstResponder
properties are not respected in viewDidLoad
?