2

I have a Swift Project, and I'm using bridging-header to call some Obj-c Classes and it works great. and I can easily use Obj-C classes alongside Swift.

But now, I have problem calling one of my Swift classes from Obj-C.

I mean I want to call fun x from y class, which is a swift class, from another obj-c class in my project.

I've used 'y-Swift.h' and some other methods, but non of them worked. :(

Reza_Rg
  • 3,345
  • 7
  • 32
  • 48
  • Did you have a look at http://stackoverflow.com/questions/24002369/how-to-call-objective-c-code-from-swift (which explains calling from Swift to ObjC *and* vice-versa)? – Martin R Jan 21 '15 at 06:59
  • @MartinR of course. that's how I used Obj-C Classes in Swift Project, but in this situation it does not help. – Reza_Rg Jan 21 '15 at 07:14
  • Its not really clear what you are asking, can you please add code examples and explain in which way it's failing for you. – Alex Brown Jan 21 '15 at 15:39

1 Answers1

0

From the documentation, you have to use something like this ProductName/ProductModuleName-Swift.h. You can get your product name from the project settings in XCode.

Another way to import is as followed:

#import "ProductModuleName-Swift.h"
Lucas Huang
  • 3,998
  • 3
  • 20
  • 29