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.
FYI the solution to this issue is just changing
#import "ProjectName-Swift.h"
into
#import "ProjectName/ProjectName-Swift.h"
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With