segment-integrations / analytics-ios-integration-firebase

Segment's bundled integration for Firebase on iOS
MIT License
13 stars 92 forks source link

Add support for Carthage #35

Closed scalessec closed 2 years ago

scalessec commented 5 years ago

Now that Firebase supports an experimental version of Carthage, is it possible to have this integration support Carthage as well?

We're a Segment customer with a large iOS app that has a modern architecture. We use Carthage instead of CocoaPods, we're 100% Swift, and our large codebase is modularized into dynamic frameworks. The part of our app that deals with analytics is in one of these frameworks. Because of this, we have no obvious way to integrate Segment Firebase into our build.

Approaches we've considered:

  1. Changing our package manager to Cocoapods instead of Carthage. Unfortunately this would be a monumental task and is out of scope given the level of effort.
  2. Adding Cocoapods on top of Carthage. This is not possible because this library is needed inside our framework and Cocoapods does not support framework targets.
  3. Integrating Firebase via Carthage and then dropping the source for this library in our framework. This is also not possible because bridging headers are not supported in framework targets.

At the moment it appears our only (potentially) viable approach is integrate Firebase into our project using Carthage, and then to manually port this library to Swift to avoid the need for a bridging header.

scalessec commented 5 years ago

Just as a followup, I was able to get our app to compile by:

  1. Installing Segment via Carthage.
  2. Installing Firebase via Carthage.
  3. Adding SEGFirebaseIntegration.h, SEGFirebaseIntegration.m, SEGFirebaseIntegrationFactory.h, and SEGFirebaseIntegrationFactory.m directly to our dynamic framework target.
  4. Following the "umbrella header" technique described here to make the files available to Swift without a bridging header: https://stackoverflow.com/questions/38800435/can-i-use-an-objective-c-class-in-my-swift-framework-library

Everything compiles and I can configure the SEGAnalyticsConfiguration with SEGFirebaseIntegrationFactory.instance(). Sounds great, except it doesn't appear to actually be working. No method in SEGFirebaseIntegration is ever invoked after the instance is retrieved from the factory and set on the config.

scalessec commented 5 years ago

Related: https://github.com/segmentio/analytics-ios/issues/802