Search Bar is flickering in Navigation Bar with Large Titles

Hello,


I have this simple app with a UINavigationController as initial view controller and a plain view controller with just a button as root view controller in there. Large Titles are set to Automatic in the Navigation Item, and on the Navigation Bar Prefers Large Titles is set to True. In viewDidLoad in the view controller I assign an instance of UISearchBar() to the Navigation Item.


class ViewController: UIViewController {

override func viewDidLoad() {

super.viewDidLoad()

let searchController = UISearchController(searchResultsController: nil)

navigationItem.searchController = searchController

}

}


The only UI element in the view controller is a button that has a league to the view controller, so I will be able to show the same view controller using the Navigation Controller.


What I want is the same behavior as in the Files App: There, the Search Bar remains static within the Navigation Bar even when navigating forward and back. In my setup this seems to work only one time, when pressing the button and first navigating to the new view controller, the Search Bar remains static. When I then go back the Search Bar will always flicker. It seems it is immediately hidden when the navigation is started and then faded back in again when it is finished. This can also be observed quite nicely when using the swipe gesture to go back.


The interesting thing is, when I’m using a compact height size class (or the app is running on an iPhone), there is no flickering… am I missing some configuration to make it work correctly on the iPad?


I have created a little video to show you and already did some searching on the problem. Unfortunately it seems I cannot share the video here. However, from my description, did any of you encounter a similar thing?


Thanks,

Peter