title: Remove clear button in UISearchBar
body: <p>I want to remove the clear button (gray x) from the UISearchBar. I tried to do it like described in <a href="https://stackoverflow.com/a/19458201">this answer</a>, but it doesn't work.</p>
  
  <p>I translated the Objective-C code from the answer and the comment below to following Swift code:</p>
  
  <pre><code>for subview in searchBar.subviews {
          configureSearchBarView(subview as UIView)
  }
  
  func configureSearchBarView(view: UIView) {
      for subview in view.subviews {
          self.configureSearchBarView(subview as UIView)
      }
      if subview.conformsToProtocol(UITextInputTraits) {
          var clearView = view as UITextField
          clearView.clearButtonMode = UITextFieldViewMode.Never
      }
  }
  </code></pre>
  
  <p>Unfortunatly this doesn't remove the clear button. </p>
  
  <p><a href="https://stackoverflow.com/a/24441925">Another answer</a> suggests to work with <code>appearanceWhenContainedIn</code>, but this method doesn't seem to be implemented in Swift.</p>
  
  <p>Any ideas?</p>