title: Using a Swift extension method in Objective-C
body: <p>I have an objective-c project which includes a swift file. I've created the bridging header and imported the ProjectSwift.h into the main file etc. </p>
  
  <p>I am trying to use methods from the extensions stored in the Swift file, but am confused by the syntax. When it was class methods I used @objc in front of my Swift methods, but currently with the extensions I have no @objc or @nonobjc (when I put @objc in front of the extension declaration I got: </p>
  
  <blockquote>
    <p>Method cannot be in an @objc extension of a class (without @nonobjc) because Core Foundation types are not classes in Objective-C</p>
  </blockquote>
  
  <p>And if I tried @objc in front of individual methods I got:</p>
  
  <blockquote>
    <p>Method cannot be marked @objc because Core Foundation types are not classes in Objective-C</p>
  </blockquote>
  
  <p>My Swift code:</p>
  
  <pre><code>extension CGImage {
      public func someFunction(var1: Int, var2: Int){
          return someThing(someVariables)
      }
  }
  </code></pre>
  
  <p>My Objective-C:</p>
  
  <pre><code>#import "MyProject-Swift.h"
  
  CGImage *temp = someFunction(var1, var2);//Must use 'struct' tag to refer to type 'CGImage'
  
  #import "MyProject-Swift.h"
  
  struct CGImage *temp = someFunction(var1, var2); //Implicit declaration of function 'someFunction' is invalid in C99
  </code></pre>
  
  <p>And the method is not showing up with autocomplete so I'm guessing I'm screwing up the syntax in my ObjC code or I need some different extension version of @objc in my Swift code.</p>