Import Objective-c framework into Swift framework (Google Analytics + Cocoapod)

后端 未结 3 742
一整个雨季
一整个雨季 2021-02-19 18:12

I\'m trying to centralize my commonly used Swift code into a framework, and part of that code uses Google Analytics. I brought in Google Analytics as a Cocoapod, but I can\'t a

3条回答
  •  一整个雨季
    2021-02-19 18:28

    The bridging header file is a specific header file to use Objective-C file into a Swift framework.

    You can find more about bridging in the Apple doc :

    Xcode creates the header file along with the file you were creating, and names it by your product module name followed by adding "-Bridging-Header.h". (You’ll learn more about the product module name later, in Naming Your Product Module.)

    So the only thing you have to make is create that file manually by choosing

    File > New > File > (iOS, watchOS, tvOS, or OS X) > Source > Header File.

    If the name of your framework is ABC,then the name of the header file should be :

    ex : ABC-Bridging-Header.h

    You can put it where you want in your framework project.

    Hope this can help someone !

提交回复
热议问题