tvOS: Avoid keyboard collapsing in a SearchController

I am implementing a SearchController for tvOS.

I have observed that the keyboard collapses automatically when the focus is moved from the keyboard to the results, if there is a UIScrollView in the results controller,

(Because of also being scrollviews, that includes having UICollectionView or UITableView in the results.)

This is the behaviour even when the search results fits on the available space under the keyboard. Which at the end results in a bad UX leaving a lot of empty space and no direct access to the keyboard.

On the other hand when the results are not scrollable, the keyboard does not collapse.

Is there a way to avoid this automatic behaviour to make the keyboard always visible?

A project reproducing this behaviour can be found in here: https://github.com/dcordero/tvos-keyboard

Replies

On tvOS 14 you may set UISearchController's searchControllerObservedScrollView to your scrollView (or collectionView in your case).
Post not yet marked as solved Up vote reply of zweg Down vote reply of zweg