如何添加Objective-C桥接标题条目? [英] How to add Objective-C Bridging Header entry?

查看:124
本文介绍了如何添加Objective-C桥接标题条目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Swift项目,并添加了一个用Objective-C编写的cocoapod.它具有头文件和实现文件.据我了解,要将这些文件使用/导入到我的Swift文件中,我需要添加一个桥接文件.

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 into my Swift files, I need to add a bridging file.

我发现此站点描述了如何手动执行此操作,因为Objective-C文件已经是我项目的一部分(来自cocoapod).

I found this site describing how to do this manually, since the Objective-C files are already part of my project (from the cocoapod).

http://www.learnswiftonline.com/getting-开始/添加-快速桥头/

1.)导航到项目构建设置,然后找到"Swift Compiler –代码生成"部分.您可能会发现更快地在搜索框中输入"Swift Compiler"来缩小搜索范围.

1.) Navigate to your project build settings and find the "Swift Compiler – Code Generation" section. You may find it faster to type in "Swift Compiler" into the search box to narrow down the results.

2.)在"Objective-C桥接标头"旁边,您需要添加标头文件的名称/路径.如果文件位于项目的根文件夹中,只需在其中放置头文件的名称即可.

2.) Next to "Objective-C Bridging Header" you will need to add the name/path of your header file. If your file resides in your project’s root folder simply put the name of the header file there.

我在该部分中没有Objective-C Bridging Header,并且没有出现,您可以在其中添加新条目.

I don't have a Objective-C Bridging Header in that section and it doesn't appear you can add new entries there.

我正在使用Xcode 7.3.1.任何人都知道应该怎么做?

I'm using Xcode 7.3.1. Anyone have some idea how this should be done?

推荐答案

您确定查看的是正确的构建设置"部分,请按照描述在搜索字段中使用关键字 Swift编译器-常规进行搜索在下面,然后您就可以找到它.

Are you sure you looked at the correct Build Settings section, search with the keyword Swift compiler - General in the search field as describe below and then you can find it.

这篇关于如何添加Objective-C桥接标题条目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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