未在 Xcode 6 中创建的 Swift 到 Objective-C 标头 [英] Swift to Objective-C header not created in Xcode 6

查看:16
本文介绍了未在 Xcode 6 中创建的 Swift 到 Objective-C 标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直致力于将 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 源文件添加到项目后,我在获取桥接头"(即 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.

但是应该公开标记为 @objc 的 Swift 类或 ObjC 类的子类的 *-Swift.h 头文件 无处b> 被发现 :-(

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.

推荐答案

现在可以了.

  1. 项目的产品模块名称必须包含空格.
  2. Defines Module 必须在 Build Settings 下的 Packaging 中设置为 Yes.
  1. Project must have a Product Module Name that does not include spaces.
  2. 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 标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆