UISearchTab with automaticallyActivatesSearch only works on second tap?

let searchTab = UISearchTab { tab in
    UINavigationController(rootViewController: SearchViewController())
}
searchTab.automaticallyActivatesSearch = true
class SearchViewController: UIViewController {
    private let searchController = UISearchController(searchResultsController: UIViewController())
    
    override func viewDidLoad() {
        super.viewDidLoad()
                
        navigationItem.searchController = searchController
    }
}

With this setup when I launch the app and tap the search tab, the keyboard will not appear. Switching tabs and tapping search again works from then on. Am I doing something wrong here?

Video here: https://mastodon.social/@nicoreese/114983627125286299

Answered by Frameworks Engineer in 852624022

Thank you for reporting the issue. You should configure the navigationItem.searchController in the view controller's initialization, which should activate search automatically as expected when the tab becomes selected.

Filed as FB19432094

Accepted Answer

Thank you for reporting the issue. You should configure the navigationItem.searchController in the view controller's initialization, which should activate search automatically as expected when the tab becomes selected.

UISearchTab with automaticallyActivatesSearch only works on second tap?
 
 
Q