问题
I'm trying to use the Swift class in my Object-c project. So far I have created the Objective-C project and imported the swift class and it asked me Would you like to configure an Objective-C bridging header?, then I hit Create Bridging Header so the productname-Bridging-Header.h file is created.
Then I changed
Always Search User Paths-->YES
SWIFT_OBJC_BRIDGING_HEADER-->YES
After that I import the swift class into my viewController.m class
Example: #import "Swiftclass.swift.h"
But it says #import "Swiftclass.swift.h" file not found
回答1:
You need to import ProjectName-Swift.h
.
If your project name contain spaces, replace them with underscores (e.g. "My Project" becomes "My_Project-Swift.h")
Like,
#import "My_Project-Swift.h"
Try like this. it will help you.
来源:https://stackoverflow.com/questions/37292578/import-swift-class-into-objective-c