How to add Objective-C Bridging Header entry?

前端 未结 2 1885
星月不相逢
星月不相逢 2021-01-14 09:53

I have a Swift project and have add a cocoapod, which is written in Objective-C. It has header and implementation files. From what I understand, to use/import these files in

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 10:33

    You need to create the header file first. It is a regular Objective-C header file and should be named -Bridging-Header.h. For any Objective-C headers you want Swift to know about add an import statement to the newly created header file. Then follow your previous steps. There is also a hidden header that gets created for you called -Swift.h. If you need to access any Swift classes from an Objective-C file import this header.

提交回复
热议问题