问题描述
我最近一直在努力将Swift添加到现有项目中,以便以实际的方式进行尝试.
I have recently been working to add Swift to an existing project, to get to try it out in a real-world fashion.
在向项目中添加Swift源文件后,我就没有将"Bridging Header"(即,Objective-C转换为Swift)的问题.
Upon adding a Swift source file to the project, I have no problems about getting the "Bridging Header", that is, Objective-C to Swift.
但是*-Swift.h
头文件本应该公开标记为@objc
或ObjC类的子类的Swift类,却找不到 :-(
But the *-Swift.h
header file that is supposed to expose Swift classes either marked @objc
or subclasses of ObjC classes, is nowhere to be found :-(
在主应用程序代码(仍然是Objective-C)中,我看不到任何有关如何完成用Swift编写的新子类的具体说明.
I don't see any specific instructions on how to accomplish the usage of my new subclass, written in Swift, in my main app code (which is still Objective-C).
我是首席开发人员的应用程序具有相当大的代码库(70.000行),因此一劳永逸地进行过渡是不可能的.
The app that I am lead developer of has a fairly large codebase (70.000 lines), so transitioning it in one go is out of the question.
推荐答案
现在可以使用了.
- 项目必须具有不不包含空格的产品模块名称. 必须在包装"下的构建设置"中将
- 定义模块设置为是.
- Project must have a Product Module Name that does not include spaces.
- Defines Module must be set to Yes in Build Settings, under Packaging.
最终有效.感谢大家的帮助:-)
Finally works. Thanks to everyone for the help :-)
这篇关于在Xcode 6中未创建Swift-Objective-C标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!