import swift class in objective-c, -Swift.h file not found

后端 未结 10 1607
野性不改
野性不改 2020-12-02 15:41

I have an iOS project written with Objective-C. I created an Swift class in the project, the bridging header file for accessing objective-c in Swift is generated successfull

10条回答
  •  一生所求
    2020-12-02 16:04

    OMG.. the actual import statement was not "class-Swift.h" but rather "projectname-Swift.h"

    You can find the name of the file if you look under build settings->Swift Compiler Code Generation -> Objective-C Generated Interface Header Name

    The file was not generated when I dragged in Swift source into the GUI. Only when I right-clicked->Add file to "project". It then asked to generate the header files.

提交回复
热议问题