I am completely new to tvos and trying to implement the UISearchController view, where in my SearchResultsViewController I have two UICollectionView displayed one above the other: 
The problem is that when the user swipes down to select one of the elements in the UICollectionView, the keyboard does not close. Even if you slide your finger up to select a keyboard, you won’t be able to fully scroll up and you won’t be able to see what you are typing. The resulting view looks like this: 
Ideally, I would like to remove the keyboard when the user swipes down to focus on something else in the interface. I looked at the Apple tvos UIKit directory, and their example shows a UISearchController that rejects the keyboard when the focus changes, but I don’t see that they do something different.
Here is the code that I use to configure my UISearchController when a user clicks a button:
@IBAction func onSearchButton(sender: AnyObject) { guard let resultsController = storyboard?.instantiateViewControllerWithIdentifier(SearchResultsViewController.storyboardID) as? SearchResultsViewController else { fatalError("Unable to instantiate a SearchResultsViewController.") } // Create and configure a 'UISearchController'. let searchController = UISearchController(searchResultsController: resultsController) searchController.searchResultsUpdater = resultsController searchController.hidesNavigationBarDuringPresentation = false let searchPlaceholderText = NSLocalizedString("Search for a Show or Movie", comment: "") searchController.searchBar.placeholder = searchPlaceholderText // Present the search controller from the root view controller. guard let rootViewController = view.window?.rootViewController else { fatalError("Unable to get root view controller.") } rootViewController.presentViewController(searchController, animated: true, completion: nil) }
source share