title: How to override swift protocol functions for subclasses (e.g. UILabel from UIView)
body: <p>I'm trying to implement an extended function that should differ based on what type of class is using it.
  The objects need to be UIView (or subclass). It should always use function extended on the specified type, but if it doesn't conform to any of them they should use the UIView method instead (as a fallback).</p>
  
  <p>Here is an example of what I'm trying to do:</p>
  
  <pre class="lang-swift prettyprint-override"><code>protocol aProtocol {
      typealias completionBlock = (_ finished:Bool)-&gt;()
      func doSomething(completion: completionBlock)
  }
  
  
  extension UIView: aProtocol {
      func doSomething(completion: (Bool) -&gt; ()) {
          print("Im an UIView")
      }
  }
  
  extension aProtocol where Self: UILabel {
      func doSomething(completion: (Bool) -&gt; ()) {
          print("im an UILabel")
      }
  }
  
  extension aProtocol where Self: UIImageView {
      func doSomething(completion: (Bool) -&gt; ()) {
          print("im an UIImageView")
      }
  }
  </code></pre>
  
  <p>Excecute:</p>
  
  <pre class="lang-swift prettyprint-override"><code>UIView().doSomething { (foo) in } // Should print "Im an UIView"
  UIButton().doSomething { (foo) in } // Should print "Im an UIView" (UIButton doesent have specified extended function so should fall back on the UIView function)
  UILabel().doSomething { (foo) in } // Should print "im an UILabel"
  UIImageView().doSomething { (foo) in } // Should print "im an UIImageView"
  </code></pre>
  
  <p>Which now prints:</p>
  
  <pre><code>Im an UIView
  Im an UIView
  Im an UIView
  Im an UIView
  </code></pre>
  
  <p>This means that it always uses the UIView method, even though I want it to use it's own methods. My goal is so it prints:</p>
  
  <pre><code>Im an UIView
  Im an UIView
  im an UILabel
  im an UIImageView
  </code></pre>