[英]Why need Objective-C bridging header in swift project?
I am new in swift . 我是新手。 I crated a swift project and I try to added
NSmanagedObject subclass
for core data but xcode telling me Would you like to configure an Objective-C bridging header? 我创建了一个快速项目,并尝试为核心数据添加
NSmanagedObject subclass
,但xcode告诉我您是否要配置Objective-C桥接标头?
what should i do ? 我该怎么办 ? and why ?
为什么?
Flowing step I done : 我完成的流程步骤:
create a single page application 创建一个单页应用程序
then try to add subclass 然后尝试添加子类
then select the entity would i mange 然后选择我要管理的实体
last things why added +coredatapropertice 最后为什么要添加+ coredatapropertice
Xcode is asking you if you'd like to create a bridging header because you are adding Objective-C files to a Swift project. Xcode询问您是否要创建桥接标头,因为您要将Objective-C文件添加到Swift项目中。
Since your project is written in Swift, I'm guessing that you meant to select 'Swift' as the language when creating your NSManagedObject subclasses. 由于您的项目是用Swift编写的,因此我猜测您打算在创建NSManagedObject子类时选择“ Swift”作为语言。
This way to gain access to a library is to use the Objective-C bridging header. 这种访问库的方法是使用Objective-C桥接标头。 Since Objective-C is a superset of C, the bridging header also works to give you access to pure C libraries.
由于Objective-C是C的超集,因此桥接头还可以使您访问纯C库。 This allow you to add the Objective-C file in our swift project
这使您可以在我们的swift项目中添加Objective-C文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.