title: Swift protocol implementing another @objc protocol
body: <p>Using Swift 4, I'm trying to write a custom protocol which provides conformance to an @objc protocol.</p>
  
  <h2>Some Code</h2>
  
  <p>More specifically, I have a custom protocol <code>Searchable</code> which provides a simple implementation of the UIKit protocol <code>UISearchBarDelegate</code>, requiring to only implement a single callback for handling search filter changes.</p>
  
  <pre><code>@objc protocol Searchable: class, UISearchBarDelegate {
    @objc func searchFilterChanged(_: String?)
  }
  </code></pre>
  
  <p>I provide the delegate implementation in a protocol extension:</p>
  
  <pre><code>extension Searchable {
    func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) {
      searchFilterChanged(searchText)
    }
    // .. and some other delegate methods
  }
  </code></pre>
  
  <p>Finally, in another extension I create and install the search bar (<code>installSearchBar</code> has to be called from <code>viewDidLoad</code> of the concrete view controller):</p>
  
  <pre><code>extension Searchable where Self: UITableViewController {
    func installSearchBar() {
      let searchBar = UISearchBar()
      searchBar.delegate = self
      tableView?.tableHeaderView = searchBar
    }
  }
  </code></pre>
  
  <h2>The Problem</h2>
  
  <p>Unfortunately, the delegate methods of <code>UISearchBarDelegate</code> are not called when the user enters text in the search bar. The compiler warns me with this message:</p>
  
  <blockquote>
    <p>Non-'@objc' method 'searchBar(_:textDidChange:)' does not satisfy
    optional requirement of '@objc' protocol 'UISearchBarDelegate'</p>
  </blockquote>
  
  <p>However, I cannot add <code>@objc</code> to the method because this causes the following compiler error:</p>
  
  <blockquote>
    <p>@objc can only be used with members of classes, @objc protocols, and
    concrete extensions of classes</p>
  </blockquote>
  
  <h2>The Question</h2>
  
  <p>So now my question is: can the desired behavior be implemented in Swift at all, or is it not possible to implement conformance to an @objc protocol in another protocol?</p>
  
  <p>Note 1: I know that this can be implemented using subclass; still I'm looking for a POP version.</p>
  
  <p>Note 2: I know there is <code>UISearchController</code> which also helps to simplify implementing search; I cannot use this class because in my actual code, I have a more complex filter view with other controls -- that's why I use a bare <code>UISearchBar</code>.</p>