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 access it from the new framework like I did from the original project because it's Objective-C and there's no bridging header support in frameworks [I'm using Swift 1.2].
The line of code I normally have in the bridging header that makes all of this work is:
#import <Google/Analytics.h>
Where exactly do I put this in my project to make this all work like it did before in the bridging header?
What I found in Apple's documentation about mixing Swift and Objective-C is this:
Importing Code from Within the Same Framework Target
If you’re writing a mixed-language framework, you may need to access your Objective-C code from Swift and your Swift code from Objective-C.
Importing Objective-C into Swift
To import a set of Objective-C files in the same framework target as your Swift code, you’ll need to import those files into the Objective-C umbrella header for the framework.
To import Objective-C code into Swift from the same framework
Under Build Settings, in Packaging, make sure the Defines Module setting for that framework target is set to Yes. In your umbrella header file, import every Objective-C header you want to expose to Swift. For example: OBJECTIVE-C
import <XYZ/XYZCustomCell.h>
import <XYZ/XYZCustomView.h>
import <XYZ/XYZCustomViewController.h>
The phrase I take to be most relevant is where it says:
you’ll need to import those files into the Objective-C umbrella header for the framework
But what is this file and how to you create it?
Apple's documentation mentions earlier (in a table):
Objective-C code
Import into Swift
#import "Header.h"
Well, I tried just creating a file "Header.h" and importing it, but that doesn't work. I don't know what they're trying to say. I can't find an "umbrella" anything in the build settings.
So my question is, how can I import this file (#import <Google/Analytics.h>) in my Swift project so that it can see the Google Analytics cocoapod framework like I would normally do in the bridging header of a normal project?
Update:
I've come to believe that perhaps the objective-c bridging header is the .h file of the same name as the project. I've now tried adding the import statement there, and the error I get is:
! Include of non-modular header inside framework module 'JBS'