ylliX - Online Advertising Network

Using Swift with Objective-C in framework project

I’m pretty sure there are lot of tutorials about mixing ObjectiveC with Swift in both ways. But most of them are covering only normal projects. If you have framework in which you need to mix both languages, you cannot create simple bridging header because you will hit “using bridging headers with framework targets is unsupported” error. What to do then?

Solution is very simple but not obvious. Usually all tutorials says you need to
#import "MyFramework-Swift.h"
but XCode will always show this file is not exists. So first you need to remove automatically created bridging header from here:

and leave only this:

And the most important thing, in your .m file use:

#import <MyFramework/MyFramework-Swift.h>

Then everything will just compile.

3 thoughts on “Using Swift with Objective-C in framework project

Leave a Reply to hariCancel reply