2

Can Firebase's GeoFire be downloaded via Swift Package Manager?

I read a comment here that it can be if Firebase is installed under the main branch instead of a version rule, but the Firebase docs only mention installing via CocoaPods.

Also, if it is possible this way, isn't it still recommended that Firebase is installed under a version rule and not the main branch?

My main concern is that I have Firebase fully integrated in my project via SPM, but now I want to add the GeoFire product. If GeoFire must be installed with CocoaPods, do I have to completely uninstall Firebase from SPM and reinstall it as a cocoa pod, or can I leave it with both...

Eric
  • 569
  • 4
  • 21
  • 1
    I would be very keen to know as well. I can try run packages using Cocoa Pods and Swift Package Manager, but this is a bit more work. I would rather stay with Swift Package Manager if possible. – Daniel C Dec 03 '22 at 12:00
  • Did you ever find an answer? – user8865059 Mar 17 '23 at 12:41
  • I don't think it is unfortunately :( – Eric Mar 22 '23 at 16:15
  • Exactly! GeoFire with CocoaPods and Firebase with SPM they don't work together. I'm trying to extract GeoFire library and add it manually and use Objective-C bridging header. I don't know if it'll work. – fullmoon Jul 21 '23 at 19:10

1 Answers1

0

This is what I did and it worked for me:

  1. I downloaded GeoFire/Objective-C from github https://github.com/firebase/geofire-objc

  2. Unzipped the library and copied the contents of the API, Implementation and Utils folders into corresponding folders I created in my SwiftUI project. The result was something like this: GeoFireObjcFiles API h GeoFire h GFCircleQuery h GFQuery h GFRegionQuery Implementation h GFQuery+Private m GFQuery h GeoFire+Private m GeoFire Utils h GFBase32Utils m GFBase32Utils h GFGeoHash m GFUtils h GFUtils m GFGeoQueryBounds h GFGeoQueryBounds m GfGeoHashQuery h GFGeoHashQuery m GFGeoHash

  3. I created a Bridging Header and #import'ed all the objective-C .h files into it See CallObjectiveCFromSwift

  4. I made sure the .m files are added to BuildPhases->CompileSources list

And that was it. I built and everything was fine.

Lexo
  • 412
  • 4
  • 6
  • Can you elaborate a bit on exactly how you did this? I'm trying to follow your answer and I'm not getting the same result. – lmunck Aug 19 '23 at 18:42