title: Undefined symbols for architecture: *Extension where Self : Protocol* referenced from: protocol witness for *protocol.func*
body: <p>In Framework1 I have the following code:</p>
  
  <pre><code>public protocol SomeProtocol{
      func doSomething()
  }
  
  extension SomeProtocol where Self : UIButton{
      public func doSomething(){}
  }
  </code></pre>
  
  <p>In Framework2, which imports Framework1 as a Cocoa pod, I add conformance to SomeProtocol like this</p>
  
  <pre><code>extension UIButton : SomeProtocol{}
  </code></pre>
  
  <p>Framework1 builds successfully, however, I receive the following Apple Mach-O Linker Error when building Framework2:</p>
  
  <blockquote>
    <p>Undefined symbols for architecture x86_64:   "(extension in
    Framework1): Framework1.SomeProtocol.doSomething () -> ()", referenced from:
          protocol witness for Framework1.SomeProtocol.doSomething () -> () in conformance __ObjC.UIButton : Framework1.SomeProtocol in
    Framework2 in SomeFile.o ld: symbol(s) not found for architecture
    x86_64 clang: error: linker command failed with exit code 1 (use -v to
    see invocation)</p>
  </blockquote>
  
  <p>If I move the protocol conformance of UIButton into Framework1 file as such:</p>
  
  <pre><code>public protocol SomeProtocol{
      func doSomething()
  }
  
  extension SomeProtocol where Self : UIButton{
      public func doSomething(){}
  }
  
  extension UIButton : SomeProtocol{}
  </code></pre>
  
  <p>Framework1 will successfully build. This does not work for me though because I need to establish UIButton's conformance to SomeProtocol in Framework2 and not Framework1.</p>
  
  <p>My current solution is simply to remove </p>
  
  <pre><code>extension SomeProtocol where Self : UIButton{
      public func doSomething(){}
  }
  </code></pre>
  
  <p>from Framework1 and implement it in the UIButton extension in Framework2 like this:</p>
  
  <pre><code>extension UIButton : SomeProtocol{
      public func doSomething(){}
  }
  </code></pre>
  
  <p>This, however, is not a good solution because I would like to be able to have this implementation of doSomething for a UIButton shared between any framework consuming Framework1. Any help would be appreciated!</p>