创建桥接头 [英] Creating a Bridging Header

查看:139
本文介绍了创建桥接头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在手动创建桥接头,因为它不允许我自动执行。我创建了一个名为 AppName-Bridging-Header.h的头文件。问题是我无法将其设置为项目的 Bridging头,通常可以通过项目的构建设置来完成。我没有 Objective-C

I am creating a Bridging Header manually since it doesn't let me do it automatically. I created the a header file called "AppName-Bridging-Header.h. The problem is that I can not set it as the project’s Bridging header, which can be normally done through the project’s build settings. I do not have the Objective-C Bridging file section under Swift Compiler -Code generation. I only have Optimization level. Thank you.

推荐答案

您的问题有点不清楚但我会尽力为您提供帮助。

Your question is a bit unclear but I'll try to help you as much as I can.


  • 借助Xcode:将文件添加到项目时,Xcode询问是否要创建桥接头。

  • 手动:您必须创建一个头文件并将其命名为您的Project-Bridging-Header.h (这是常规语法)

  • With the help of Xcode : When you add a file to your project, Xcode asks if you want to create a bridging header.
  • Manually : You have to create a header file and name it Your Project-Bridging-Header.h (This is the general syntax)

  • 如果Xcode创建了桥接标题,它将自动链接到:->建立Setti ngs-> Swift编译器-代码生成-> Objective-C桥接标题

  • 如果您是手动创建的,则必须在构建设置标签下进入此处,然后搜索桥接标题。然后,在这里有 Objective-C桥接标题行,只需输入他所在的文件夹的名称和名称。这样:您的项目/您的Project-Bridging-Header.h 。文件夹名称如屏幕快照所示定义。无论项目名称(第一个箭头)和第一个方框(第二个箭头)是否不同,只要选择正确的名称即可。

  • If Xcode created the bridging header it is automatically linked under : -> Build Settings -> Swift Compiler - Code Generation -> Objective-C Bridging Header
  • If you created manually you have to go here under the "Build Settings" tab and then search for "Bridging Header. Here then you have the row "Objective-C Bridging Header" and you just have to put the the name of the folder he's in and his name. Like that : Your Project/Your Project-Bridging-Header.h. The name of the folder is defined as the screenshot shows. Doesn't matter if the project name (first arrow) and the first box (second arrow) are different, just take the right one.

希望这对某人有帮助:)
很抱歉从一开始就进行了解释,因为在问题中并未提出该要求,但有时尽一切所能很好

Hope this helps someone :) Sorry for explaining from the start as it is not asked in the question but sometimes it is good to have the all way of doing

这篇关于创建桥接头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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