title: UISearchBar color in NavigationBar
body: <p>I feel like I’m taking crazy pills.  I want to change the color of the textfield within a UISearchBar, which is hosted in a UINavigationBar.  The problem I’m having is that the UISearchBar gets the color of the UINavigationBar but the TextField doesn’t change color.  I’ve tried several solutions here, but none of them seem to solve the issue.  Any ideas how to change the TextField’s color?</p>
  
  <p>I know there are other questions out there similar to this but I’ve tried every possible solution I’ve come across and haven’t found one that solves my issue.</p>
  
  <p><a href="https://i.stack.imgur.com/evp9e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/evp9e.png" alt="Current Nav Bar with Attempted Bar tint"></a></p>
  
  <p>Current Code:</p>
  
  <pre><code>        let sc = UISearchController(searchResultsController: nil)
          sc.delegate = self
          let scb = sc.searchBar
          scb.tintColor = UIColor.green
          scb.barTintColor = UIColor.yellow
  
  
          if let textfield = scb.value(forKey: "searchField") as? UITextField {
              textfield.textColor = UIColor.blue
              if let backgroundview = textfield.subviews.first {
  
                  // Background color
                  backgroundview.backgroundColor = UIColor.red
  
                  // Rounded corner
                  backgroundview.layer.cornerRadius = 5;
                  backgroundview.clipsToBounds = true;
  
              }
          }
  
          navigationController?.navigationBar.barTintColor = UIColor.blue
  
          navigationItem.searchController = sc
          navigationItem.hidesSearchBarWhenScrolling = false
  </code></pre>
  
  <p>I’ve created a <a href="https://github.com/g0ld2k/TestSearchBar" rel="nofollow noreferrer">sample project</a> to show it in action.  Any help or guidance would be greatly appreciated!</p>