Xcode linking issues with multiple frameworks

671 views
Skip to first unread message

Niall McCormack

unread,
Oct 1, 2024, 9:18:37 PM10/1/24
to Firebase Google Group
Hi all, 

I'm splitting a monolithic Xcode project into multiple frameworks. There are 2 frameworks that need FirebaseFirestore as a dependency.

The Firebase SDK is managed by Xcode Swift Package Manager.

As far as I understand, because I can't set an Xcode / SwiftPM Package as "Do Not Embed" Xcode ultimately tries to embed the FirebaseFirestore framework twice.

What is the recommended approach to get this working?

This Stackoverflow reply suggests that there is a way to force Xcode to allow "Do Not Embed"

But I'm wondering if there is a more "official" route :)

Cheers
Niall

Niall McCormack

unread,
Oct 2, 2024, 5:37:25 PM10/2/24
to Firebase Google Group
To be clear, if I try to import FirebaseFirestore library to multiple frameworks then I get a lot of linker errors and the application won't build.

Niall McCormack

unread,
May 9, 2025, 4:00:59 PMMay 9
to Firebase Google Group
I found a solution a while ago, but forgot to reply to my own thread.

- In my project I have a Framework called `EmbeddedFirestore`
- In the Xcode General > Frameworks & Libraries 
- I add the FirebaseFirestore and FirebaseFirestoreSwift to the EmbeddedFirestore target
- I have one Swift file in this framework with the following lines

@_exported import FirebaseFirestore
@_exported import FirebaseFirestoreSwift

- And then when I need to use Firestore I import EmbeddedFirestore into my project and it works as expected.

The above code essentially ensures that the FirebaseFirestore SDKs is imported into the project once, and then made available _externally_ from the EmbeddedFirestore framework to anyone that wants to use it.
Reply all
Reply to author
Forward
0 new messages