Search code examples
iostvosuikeyboard

TVOS UISearchController keyboard stopping to show


In my TvOS app I have a viewController with UISearchContainerViewController. Here is the tree of views:

enter image description here

and

enter image description here

The searchController looks good and work as needed. From this viewController I can go to another one and from there open another instance with initial viewController (with searchController). In this another instance the everything is well too. BUT, when i pop back to the first instance the keyboard disappearing and the tree looks like:

enter image description here

I think it's because the instance of the system keyboard is shared across the app. But i don't know how to fix that. Can you help me?


Solution

  • private var keyboardContainer: UISearchContainerViewController!
    

    In initialController I did add

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
    
        keyboardContainer.searchController.searchBar.becomeFirstResponder()
    }
    

    and it seems that fixed the issue.