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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.