Is it possible to import third-party Objective-C code into a Swift playground? [duplicate]

試著忘記壹切 提交于 2019-12-21 03:51:42

问题


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.

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

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


回答1:


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.



来源:https://stackoverflow.com/questions/24043240/is-it-possible-to-import-third-party-objective-c-code-into-a-swift-playground

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!