是否有可能将第三方Objective-C代码导入到一个快速游戏中?(复制)

时间:2021-09-21 11:54:49

This question already has an answer here:

这个问题已经有了答案:

As suggested here I've been able to import my existing Objective-C code into a .swift file via the bridging header. As of yet I've been unable to do something similar with a swift playground - it does not seem to recognise the header in the same way that a swift file does.

正如这里提到的,我已经能够通过桥接头将现有的Objective-C代码导入到.swift文件中。到目前为止,我还不能在快速运动场上做类似的事情——它似乎不能像快速文件那样识别标题。

Interestingly, and possibly suggestive of a negative to my question is that playgrounds do not appear to share the concept of target membership like .swift/.m

有趣的是,这也可能暗示了我的问题的消极之处在于,运动场似乎并不像。swift/。m这样的目标成员

Anyone had any success with this or perhaps a different mechanism?

有人在这个或者可能是另一个机制上成功过吗?

1 个解决方案

#1


4  

See Using Swift with Cocoa and Objective-C for how to set up an Xcode project for importing Swift into Objective-C. Then create a playground in that project and the playground should be able to work with any of the ObjC classes in the project.

有关如何将Swift导入到Objective-C的Xcode项目,请参见使用Swift与Cocoa和Objective-C结合使用。然后在这个项目中创建一个运动场,这个运动场应该能够与这个项目中的任何ObjC类一起工作。

#1


4  

See Using Swift with Cocoa and Objective-C for how to set up an Xcode project for importing Swift into Objective-C. Then create a playground in that project and the playground should be able to work with any of the ObjC classes in the project.

有关如何将Swift导入到Objective-C的Xcode项目,请参见使用Swift与Cocoa和Objective-C结合使用。然后在这个项目中创建一个运动场,这个运动场应该能够与这个项目中的任何ObjC类一起工作。