Search code examples
xcodefirebaseswift-package-manager

Adding Firebase package to Xcode with SPM results in an increase from 200 to 1800 build files


I followed this official guide to adding Firebase to my project:
https://firebase.google.com/docs/ios/setup?hl=en#swift

Once you add https://github.com/firebase/firebase-ios-sdk in Swift Package Manager, it prompts you a window to select which sub-packages of Firebase you actually want. I selected 4 of them:

  • FirebaseAnalytics
  • FirebaseFirestore
  • FirebaseStorage
  • FirebaseAuth

Before this, my project had 2 package dependencies. After resolving, my project now suddenly has 15(!) packages installed (black are the two installed by me):

enter image description here

And my build files increased from ~90-150 to 1800(!):

enter image description here
(which now takes about 10 times longer for any preview or simulator to run)

I have used the exact same Firebase dependencies in AndroidStudio for my Android version and there it never destroyed my build like that.

This looks like a bug to me. Is this how it normally goes? Why are there so many third-party packages contained in there?


Solution

  • This is expected behavior. The packages shown are Firebase or Firebase dependencies except for SwiftProtobuf. A significant majority of the increased number of files and build time comes from Firestore and its dependencies which is substantially bigger than anything else in Firebase.

    See a related issue at https://github.com/firebase/firebase-ios-sdk/issues/6564