title: How to extend an Objective-C class with Swift in a framework?
body: <p>I have an (OS X) Objective-C framework to which I want to add some Swift extensions and I'm using Xcode 7ß6 to work with this.  There is class in the framework (let's call it "Sample") implemented in the files "Sample.h" and "Sample.m" .. "Sample.h" contains:</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  @interface Sample : NSObject
  @property   int     x;
  @end
  </code></pre>
  
  <p>.. and "Sample.m" contains:</p>
  
  <pre><code>#import "Sample.h"
  
  @implementation Sample
  - (instancetype) init {
      if ((self = [super init]) == nil) return nil;
      self.x = 99;
      return self;
  }
  @end
  </code></pre>
  
  <p>I have added "Sample.swift" to the framework containing:</p>
  
  <pre><code>import Foundation
  
  extension Sample {
      func PrettyPrint () {    
          print("\(x)")
      }
  }
  </code></pre>
  
  <p>This is clearly a trivial version of what I want to do in a larger context, here I want to use the Swift file to extend "Sample" by adding a "PrettyPrint" function.</p>
  
  <p>.. the framework builds without error, but the framework function "PrettyPrint" is not visible to a calling app.  App code calling into the framework like:</p>
  
  <pre><code>import Foundation
  import TestKit
  
  let  sample = Sample()
  sample.PrettyPrint()
  </code></pre>
  
  <p>fails on "sample.PrettyPrint()" with: <em>Value of type 'Sample' has no member 'PrettyPrint'</em></p>
  
  <p><strong>Why does this fail?</strong> and <strong>Can it be made to work?</strong></p>
  
  <p>Extra info: If I remove the file "Sample.swift" from the framework and place it the app which is calling into the framework, the "Sample" class is successfully extended and "sample.PrettyPrint()" works as expected (printing "99").</p>