title: iOS Swift 3: Setting UISearchBar ScopeButton text and Background color
body: <p>I am working with a search bar that contains two scopes (Users and Groups) that i would like to make the button and text color the default blue and white depending on the selected state. </p>
  
  <p><strong>Please see the screenshot below:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/rVkNJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rVkNJ.png" alt="enter image description here"></a></p>
  
  <p>I have set the background image for the searchbar/scopebars as seen below to produce a "clear" background:</p>
  
  <pre><code>    searchBar.backgroundImage = UIImage()
      searchBar.scopeBarBackgroundImage = UIImage()
  </code></pre>
  
  <p>As can be seen above, the background for the "Groups" scope button is clear rather than white and the same can be said for the "Users" text. Please note i am okay with the default iOS "Blue" color used for the border and the text of any unselected scopes. 
  So my question is as follows:</p>
  
  <p><strong>How do you set the color of the scope button background/text depending on the selected state?</strong></p>