How do I create a bridging header to use swift with objective-c

I can’t remember how I created a bridging header in Xcode in order to use Swift code with Objective-C. The Help search in Xcode doesn’t turn up anything.

Hi @brower

You don’t need to create it manually, it is created automatically by xcode when you create or import a new swift file. Take a look at this stackoverflow question - https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html, there are a lot of useful tips.

Hope this is helpful.

Nikita

So if I have an SDK for Objective-C, would I have to use an Objective-C project and import Swift files, or could I use a Swift project and import the whole SDK which is in Objective-C?

Hi @brower

You can mix Swift with Objective C and visa versa. So both scenarios you’ve described are possible. But what to choose is up to you.

Let me know if you have any other questions

Nikita

This topic was automatically closed after 166 days. New replies are no longer allowed.