Getting two searchBar in iOS 26.0

Hi team, while i am using below code, i am getting two searchBar at top & bottom. Kindly refer below code & attached image

Code:

override func viewDidLoad() {
    super.viewDidLoad()
    title = "Test Data"
    setupSearchData()
    DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
        self.setupSearchData()
    }
}

func setupSearchData() {
    navigationController?.navigationBar.prefersLargeTitles = false
    let searchController = UISearchController(searchResultsController: nil)
    navigationItem.searchController = searchController
}

It is working fine for other iOS versions. In my real useCase, i will refresh screen after API completed, then this issue occurred in my app.

My referenced image

Line 4 runs the setupSearchData() function. Why do you then run the same function again two seconds later in lines 5-7?

Remove one of these and see what happens.

Getting two searchBar in iOS 26.0
 
 
Q