Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 619
Michael Avatar asked Jun 04 '14 16:06

Michael


1 Answers

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.

like image 155
rickster Avatar answered Oct 23 '22 15:10

rickster