0

Does anyone know why setting the text color of the search bar programmatically in viewDidLoad does not work and is requiring setting it to .white in viewWillAppear?

var searchController = UISearchController(searchResultsController: nil)

searchController.searchBar.delegate = self
    
searchController.searchBar.sizeToFit()
searchController.obscuresBackgroundDuringPresentation = false
searchController.hidesNavigationBarDuringPresentation = false

searchController.searchBar.placeholder = "Search here"
searchController.searchBar.searchTextField.textColor = .white

self.navigationItem.searchController = searchController
justdan0227
  • 1,374
  • 18
  • 48

1 Answers1

0

As mentioned above, this has to be done in ViewWillAppear

justdan0227
  • 1,374
  • 18
  • 48