如何在目标C中使用Swift文件 [英] How to use swift files in objective c
问题描述
我想在Objective-C代码中使用我的Swift文件.我找到了不同的链接,说明如何操作.
I want to use my Swift files in Objective-C code. I found different link that say how to do it.
我的项目名称是:Test-Project.
My project name is: Test-Project.
我将#import"Test-Project-Swift.h"导入到我的.m文件中,以使用在目标c源代码中分类的所需内容.
I imported #import "Test-Project-Swift.h" to my .m file to use needed classed in objective c source code.
我观看了此视频,没有问题,但是我有'Test-Project-Swift.h找不到文件.
I watched this video and there is no problem, but I have 'Test-Project-Swift.h' file not found.
推荐答案
我们认识到: 似乎是-"的问题,我们需要将其更改为"_"-"Test_Project-Swift.h".我已经在项目设置中检查了Objective-C生成的接口头名称.
As we recognized: It looks like the problem with "-" we need to change it to "_" - "Test_Project-Swift.h". I've checked Objective-C Generated Interface Header Name in the project settings.
这篇关于如何在目标C中使用Swift文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!