Search code examples
objective-cswiftibeaconbeacon

Import Objective-c framework into Swift framework project


I am building a framework in which I need to import some objective-c frameworks.

For now I need to import "Beaconstac.framework", but we can not add a bridging header in a swift framework project.

How can I use this framework in my project?

I tried:

import Beaconstac

But the compiler reports error "No Such Module"

Is there any alternative way to do this?


Solution

  • You need to import the Beaconstac framework in your umbrella header. That is, if you'd ordinarily use, e.g., #import <Beaconstac/Beaconstac.h> in an Obj-C bridging header, for a framework you need to put that in the umbrella header.

    See this chapter in Apple's documentation for more info:

    https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html#//apple_ref/doc/uid/TP40014216-CH10-ID130