[Pre-Pitch] Adding mixed language support in SwiftPM

Hi everyone,

In Firebase we have many Objective-C libraries and some Swift extensions that add APIs for features like Codable, async/await (where it doesn't auto-translate), and SwiftUI integrations. CocoaPods supports mixed languages but SwiftPM does not, so Firebase SDKs need to provide two separate modules (ex. FirebaseRemoteConfig and FirebaseRemoteConfigSwift). This results in a poor user experience and a potential doubling of the number of frameworks to manage (one existing Obj-C module and a Swift module).

We're investigating the feasibility of adding mixed language support to SwiftPM in order to alleviate these issues and wanted to check in beforehand:

  • Is this something that would be accepted as a contribution?
  • Have there been any previous attempts to add support that we should be aware of?
  • Any hidden complexities or things we should know before digging in?
  • Is it feasible to add cross-language support without touching Xcode?
  • Would this be helpful to others in the community as well?

We haven't taken too close a look at what it would do to the Package Manifest's API surface, if anything, but will do so once we have a better idea of the scope of the project.

Thanks,
Ryan from the Firebase team

10 Likes

As a follow up for anyone looking at this thread, tl;dr I met with the SwiftPM folks during a WWDC lab and we're continuing our investigation. Will post updates here as we go!

7 Likes

To comment on this, one other place that pretty heavily uses mixed languages is React Native. React Native uses Objective-C macros a lot (such as RCT_EXTERN_METHOD).

I'm not involved in react native core development, but I assume them moving to SwiftPM is pretty much impossible, even if they or that community wanted to.

1 Like

The lack of mixed language targets in SwiftPM is essentially a hard blocker for my own full adoption of SPM in the open source libraries I maintain, as well as for my day job where we use several (internal) frameworks whose implementations are in mixed ObjC/Swift, and where the ObjC depends on the Swift and vice versa.

All that is to say, this is honestly the most important missing feature of SPM for me, and has been for some time.

4 Likes