3

I build framework, which has both Obj-C and Swift file. I need to import Swift file into Obj-C file using:

#import "ProjectName-Swift.h"

All Build settings are default, despite Defines module set to YES, Obj-C Generated Interface Header Name to $(PROJECT_NAME)-Swift.h and Always embed Swift Standard Libraries to YES (for both project and target).

Unfortunately I have error:

'ProjectName-Swift.h' file not found

when I build the project. How should I cope with importing Swift file into Obj-C?

I need to import Swift to Obj-C, not the other way.

emil
  • 35
  • 2
  • 15

2 Answers2

3

FYI the solution to this issue is just changing

#import "ProjectName-Swift.h"

into

#import "ProjectName/ProjectName-Swift.h"
emil
  • 35
  • 2
  • 15
3

Just to add to the given answers.

Make sure your swift class is like this..

@objcMembers class SomeClass: NSObject {
  //Whatever you wish
}

This @objcMembers does the magic.

This is important since your objects need to be compiled into objc objects.

GyroCocoa
  • 1,542
  • 16
  • 19