Closed WarSunsOfPeace closed 4 years ago
It seems that adding firebase with the Swift Package Manager is still not working.
I am using 11.5 Xcode (11E608c) on macOS catalina 10.15.5, with swift 5.2.4
I entered this url into the web address box. https://github.com/firebase/firebase-ios-sdk
The default option is to use by Version up to Next Major 6.26.0
I get this error.
Package Resolution Failed firebase-ios-sdk could not be resolved: Fetching https://github.com/firebase/firebase-ios-sdk https://github.com/firebase/firebase-ios-sdk has no Package.swift manifest for version 6.26.0 Activity Log Complete 1 Error.
@sk92129 you'll have to be a bit more patient. It will only work with Swift 5.3, whenever it's released. We all guess Xcode 12 at WWDC on June 22nd. Until now, Xcode 11.5 has Swift 5.2.4, which doesn't support binary frameworks yet.
@sk92129 you'll have to be a bit more patient. It will only work with Swift 5.3, whenever it's released. We all guess Xcode 12 at WWDC on June 22nd. Until now, Xcode 11.5 has Swift 5.2.4, which doesn't support binary frameworks yet.
@stuffmc I think the ones that should have been more patient is Google. Fabric worked like a charm. Now I moved on to TestFlight and I have no time to go back and forth testing things that are not finished. This should have not been released yet. Period. They lost me as a user for both Fabric and Firebase.
Can somebody please lock this thread to stop in the influx of unhelpful and unrelated comments? This issue is of importance to me, but only actionable information would be appreciated at this point.
Sorry about the noise, but since this is an open issue and both the Firebase SDK and Swift Package are open source projects, I'd prefer to keep the channel open for constructive conversation with the community.
If anybody is repeatedly abusive or off-topic, they will be reported and/or blocked.
As mentioned above, we expect to be able to move forward with Swift Package Manager support when Apple releases the binary framework support integrated in Xcode.
We've made some progress in the last week and currently have the FirebaseStorage quickstart running with FirebaseAuth, FirebaseStorage, and FirebaseStorageSwift integrated via the Swift Package Manager. To try it out, follow along or contribute, see #5706 and https://github.com/firebase/firebase-ios-sdk/tree/spm-master2020.
I think WWDC20 has changed the situation, right?
https://developer.apple.com/videos/play/wwdc2020/10147/
https://developer.apple.com/documentation/swift_packages
As per beta's changelog, Xcode 12 will bring support for resources, binary frameworks and more using SPM
Thanks for the comments folks - you're right: we got a lot of things we've been waiting for! We're working on getting this up and running and working out some issues like binary targets having dependencies on other targets. We'll update this thread as we make progress and when it's ready for further testing.
Thanks for your patience with us on this!
Hey everyone,
As promised, I have an update on progress. In order to make it easier to track, we created a GitHub Project with "To do", "In Progress", and "Done" columns that show the current status.
New challenges we've seen include supporting different platforms for different libraries (i.e. DynamicLinks only supports iOS, but others support macOS and tvOS as well), and a limitation where we have to run all unit tests for the package on CI instead of just running a subset (useful for only running Auth tests when Auth changes, etc. Forum post). We'll be filing some Feedback, using work-arounds if we can, and will look at making contributions where possible as well to support these use-cases.
For those that are eager to try it out, the following SDKs are available already when using Xcode 12: Auth, Core, Crashlytics, Functions, Installations, and Storage (with StorageSwift). I don't recommend mixing CocoaPods and SwiftPM but if you need only that subset of products, please give it a go and let us know (in a separate issue) if you run into problems for those specific libraries. You'll have to use the master
branch at the moment but should be able to use the CocoaPods-6.28.0
tag in the next couple of days.
Thanks, and once again we appreciate the patience as we work through this!
Sounds cool! Would it be possible for you to start implementing Firestore first? I think many (at least me) use the Auth-Firestore-Storage combo in many projects and are waiting for this product to start testing. Thanks so much!
@ryanwilson Can the platform differences be resolved using the #if canImport(ModuleName)
directive? Seems like what packages like SwiftLint is doing. I'm not sure if it's the same issues though.
@lorenzofiamingo We'll see what we can do, but Firestore will likely be one of the last libraries to support Swift Package Manager because of its complicated dependency structure.
@dvanwinkle @ryanwilson is more on top of this than me - but I believe #if canImport(ModuleName)
or other #if
options would work in the sources, but we'd ideally like to specify different platforms for certain .library
s in the Package.swift
.
In other news, we're making progress on enabling unit testing in https://github.com/erikdoe/ocmock/pull/442
I look forward you migrate the pods Firebase/Crashlytics
and Firebase/Analytics
to SwiftPM 🙂
@dvanwinkle thanks for the suggestion! That can definitely be helpful and we'll need to end up using it, but wasn't what we had originally hoped was possible. To keep it short, the ideal situation would be a library that is only visible to a subset of platforms specific in the Package.swift
manifest (currently the Package
itself defines platform support). That's not possible, so we'll need to now include all the sources for every platform and make sure SDKs that only support some platforms (such as DynamicLinks not being able to support tvOS since there's no browser on tvOS) can compile on that platform, or exclude the source entirely.
The new plan is to mark all those APIs with @available
only marking the correct platform availability and ensuring that it can compile otherwise. An alternative would be to wrap each file in a #if TARGET_OS_<PLATFORM>
check, but that's a big more involved and leaves to sources to be compiled at all which could cause some confusion. We'll see how this plan goes 😄.
@lorenzofiamingo thanks for that link as well, we may have been able to make something work with that but it still has the problem of the original target being available only for certain platforms, which as far as I can tell would mean it needs to be in a different Package manifest.
@TofPlay Crashlytics is ready but keep an eye out on the tracker for Analytics - there are likely a few other things to try to get done before Analytics but we're working through the list.
I've seen a couple of URLs to try out SPM. @ryanwilson, do you have a recommended target to use with SPM for now?
@stevekellogg We don't yet recommend using SPM with Firebase for production development.
However, if you'd like to try out early versions, we'd love to get your feedback.
The spm-master2020
branch is stable with support for Storage and Auth.
The master
branch is more complete. See the products in https://github.com/firebase/firebase-ios-sdk/blob/master/Package.swift for details. The Package.swift in the master branch requires Xcode 12. We're actively working there and there may be stability fluctuations.
Please open separate issues with any feedback.
Perfect, thanks @paulb777. Yes, understood that this is not for production. I'm just looking to try it out on a new project that won't hit production till January at the earliest.
Am I right in thinking that RemoteConfig isn't yet supported by the SPM package? It is mentioned in the Package.swift, however just importing Firebase doesn't expose it.
Hi,
I have attempted to add the sdk through SPM. I am using XCode 12 beta, branch master. But when I attempt to add the package it says "has no Package.swift manigest for version 6.26.0...
Hi,
I have attempted to add the sdk through SPM. I am using XCode 12 beta, branch master. But when I attempt to add the package it says "has no Package.swift manigest for version 6.26.0...
Instead of selecting a specific version, please just choose the master branch by just selecting the second radio button in the first screenshot you posted.
Thank you.
@ttimpe Good catch! Thanks for pointing out the oversight in the Package.swift. Fixed in #6105
@mdanazhiev As @ttimpe pointed out, the master branch should be specified.
We're intentionally not supporting version installation yet to make it clear that Firebase SPM support is still a work in progress, only intended for evaluation and feedback, and not recommended for inclusion in production apps.
I was just testing, my bad not checking with selecting branch not version.
Is there any timeframe for the other missing packages to be included in the SPM release like Analytics? Ideally, SPM support should be stable by September with the upcoming release of iOS 14. A lot of other developers are, like myself, also getting rid of CocoaPods wherever they can as it can mess up lots of stuff.
I fetched repository.
Well, it would be nice to have an installation instruction. You have a lot of libraries and I don't know which library I should link to my app target if I want, for example, use only Crashlytics.
Also, you have to put a lot of #if
/ #canImport
statements to target iOS 13 and Combine
. Promises
and GTMFetcherSession
are unnecessary. Please, don't add these dependencies.
@lolgear Firebase SPM support is still a work in progress, so documentation is not a priority now. Anyway, when you add the package, XCode gives you the possibility to choose the package products of the repo. You should simply select the one you want. If they've added Promises and GTMFetcherSession probably they are using them in the package product you've selected.
Ok, so this is more of an SPM question than a Firebase question, but wondering if someone here knows. I'm using the new SwiftUI "multiplatform" template, and I'm trying to use SPM to include Firebase (for testing and evaluation). When I try to attach the Firebase package, XCode doesn't seem to allow me to attach it to BOTH the iOS and macOS projects, but it seems that I can attach it to either. Does anyone here know how I could attach it to both?
@stevekellogg try this: Consume Swift Package for multiple targets
Hi guys, does this issue mean we only can use Xcode 12 beta currently? (Xcode 11.6, using master Branch)
Personally, the sdk team could pay more attention on SPM part rather than CocoaPods because SPM will become more mainstream in the future. Especially, SPM is quite easy for developers, and it is a official feature powered by Apple.
@lwfnz Yes - Xcode 12 is required. SPM introduces some necessary features like binary and resource support with Xcode 12.
We completely agree that SPM is growing in importance, but it's still early days. SPM is just now adding the features necessary to support large, long-standing code bases. See this Twitter discussion for more on current SPM limitations.
@paulb777 Thanks for your quick reply.
It is certainly that the Cocoapods supports is important as well in the next year. Nonetheless, from new firebase users perspective, it would be significant to provide a fast lane to easier adopt firebase in their projects. Because this is not about tech but about market share competition among Google, AWS and MS.
Best wishes for your team.
@lwfnz Thanks! It's a priority for us to get the SwiftPM fast lane in place. In the meantime, we'll continue to make sure the CocoaPods experience is as smooth as possible.
I noticed FirebaseFirestoreSwift
and FirebaseUI-iOS
aren't in the todo project (https://github.com/firebase/firebase-ios-sdk/projects/1) can/should they be added please?
@nikitaame FirebaseFirestoreSwift
is in progress in #6072 and I've successfully built and run the Firestore quickstart with it. FirebaseUI is out of scope of the SDK project. I recommend opening a feature request at https://github.com/firebase/FirebaseUI-iOS. However, I did do a hacky minimal implementation in https://github.com/firebase/FirebaseUI-iOS/tree/pb-spm sufficient for the Firestore quickstart.
@paulb777 (and anyone else working on this) Excellent work, exciting progress!
Something changed yesterday and I can no longer update or install the package. It's worked of weeks and worked fine around 6:30 am, but I haven't been able to get it to work since sometime yesterday afternoon. Adding the package seems to work when the Firebase package is imported into another package, but adding Firebase directly or indirectly into a project fails with an error saying that the package can't be resolved. This consistently happens after the fetching of https://github.com/paulb777/nanopb.git. The error is quite long and includes some local path info but ends with rev-parse --verify '82230e9998a35a3d2144884204db64f045c880c4^{commit}' output: fatal: Needed a single revision
@ishabazz It seems that SwiftPM only clones a limited set of repo branches. Our CI caught the issue and we should merge #6187 to master later today to resolve. In the meantime the branch pb-fix-git
is a workaround.
Are there installation instructions?
I'm new to Firebase and followed the console's setup instructions, simply swapping out the CocoaPods step with SPM (File > Add Swift Package > github URL > FirebaseAnalytics). Whatever I did was wrong because I couldn't get the SDK to actually contact the service. The only way I was able to get things working was by nixing SPM and manually downloading the frameworks, which is less than ideal.
Are there installation instructions?
Please select the "master" branch when adding the repo as a Swift Package.
Hi guys, I'm having a problem with FirebaseFirestore using the SPM, I'm sure I included it in the Targets -> Framework, Libraries
@ttimpe That's what I did. Are things just supposed to work at that point? If I need Analytics and Crashlytics in my app, do I just need the FirebaseAnalytics
and FirebaseCrashlytics
packages? Or do I also need Firebase
or FirebaseCore
? The instructions in the console say that I should be able to import the module Firebase
in my code, but that module isn't available for me via SPM. I need to use FirebaseCore
instead.
@jchitel The Firebase
module is available via SPM.
@greyder We'll likely need a reproducible example to help investigate.
@paulb777 would it be better for me to create a separate issue to dig into this further? I'd rather not bloat this issue with my specific problems.
@jchitel Yes. Please create separate issues to discuss specific Swift Package Manager problems/questions.
Hi, when I added Firebase Analytics using SPM, the app size got increased by 20 MB, I don't think that this is normal.
EDIT: I have opened an issue here with more details.
Hey @FaroukZeino, as per Paul's comment previously it might be best to raise this as a new issue so it can be tracked and discussed on it's own.
With iOS support for Swift Package Manager in Xcode 11 can we please get that added to this project.