创建了一个oc项目,使用cocoapods导入了一个swift编写的框架(SwiftTheme)
根据这个框架的oc Demo,正常情况应该是会自动生成一个"项目名-swift.h"的文件并且import进oc项目才可以使用。
但在我的项目里#import"项目名-swift.h"
却提示找不到,显示一个大大的问号。
除非自己手动new一个swift文件,#import"项目名-swift.h"
就会成功.
ps:让我改Defines Module、Product Module Name之流的就不用回答了,我会用百度,不管用才来这儿问的。
Using swift in oc is a little more troublesome. Do I need to set the project name or something? Forgot. Baidu has it. You search for swift oc mixed code
I am also from Baidu. This is what I summarized before. Researched: http://mog.pub/
In fact, it can be like this:
@import xxSDK;
另外,你的写法应该是
#import <xxSDK/xxSDK-Swift.h>
,用
<xx/xx.h>
instead of quotation marksThe legend is a pure swift framework written by me.
ps: If you want me to change the Defines Module, Product Module Name, etc., you don’t need to answer. I can use Baidu. That’s why I came here to ask if it doesn’t work.
After making the change, use command+click with the left mouse button to enter the "project name-swift.h". Have you tried it?
Solved, no need for cocoapods, just drag the third-party framework source file into the project and it will be automatically generated
"项目名-swift.h"
.Although it works, I still don’t understand why it can’t be generated using cocoapods. No matter.
The premise of import "project name-swift.h" must be in the same module. If it is not in the same module, the target namespace must be added in front, in the form of #import <xxSDK/xxSDK-Swift. h>.
You are using pod. The Alomafire introduced by pod is in a different target, so the following method is effective.