Firebase-ios-sdk: Error on SwiftUI Preview when using Swift Package Manager

Created on 17 Aug 2020  路  3Comments  路  Source: firebase/firebase-ios-sdk

Environment

  • Xcode version: 12.0 beta 4
  • Firebase SDK version: master branch
  • Firebase Component: Auth, Firestore, Storage
  • Installation method: Swift Package Manager

Problem

Steps to reproduce:

When I build and run the app all is working ok. When I try to use the SwiftUI Preview Canvas XCode raises me errors.

Error Logs:

Swift package target 'GoogleUtilities_Environment' is linked as a static library by 'ioniCup (iOS)' and 4 other targets. This will result in duplication of library code.
Swift package target 'GoogleUtilities_Logger' is linked as a static library by 'ioniCup (iOS)' and 4 other targets. This will result in duplication of library code.



md5-ff2f6b34ba89c546d876990a2a9b9e0c



Swift package target 'FirebaseStorage' is linked as a static library by 'ioniCup (iOS)' and 'FirebaseStorageSwift'. This will result in duplication of library code.



md5-ff2f6b34ba89c546d876990a2a9b9e0c



Swift package target 'FirebaseFirestore' is linked as a static library by 'ioniCup (iOS)' and 'FirebaseFirestore'. This will result in duplication of library code.



md5-ff2f6b34ba89c546d876990a2a9b9e0c



Swift package target 'FirebaseCore' is linked as a static library by 'ioniCup (iOS)' and 4 other targets. This will result in duplication of library code.
Swift Package Manager

All 3 comments

@lorenzofiamingo Thanks for trying out the Swift Package Manager support and the feedback. This looks like a known Xcode issue described at https://forums.swift.org/t/swift-packages-in-multiple-targets-results-in-this-will-result-in-duplication-of-library-code-errors/34892/38:

There is an entirely separate issue which happens only for Xcode previews which is related to all package products being built dynamically in Xcode 12 to enable previews. It is also something we're actively investigating. There is no workaround for this, since users do not have control over how builds for preview are being done.

Might be fixed in Xcode 12 beta 5 - https://forums.swift.org/t/swift-packages-in-multiple-targets-results-in-this-will-result-in-duplication-of-library-code-errors/34892/40.

I'll plan to retry in the next day or two - but feel free to beat me to it. :)

Confirmed that Xcode 12 beta 5 fixes Swift UI preview for all Firebase products except Firestore.

It exposes a build issue in its abseil dependency for which I'll send a PR for.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skuske picture skuske  路  3Comments

matthieuchappaz picture matthieuchappaz  路  3Comments

PierBover picture PierBover  路  3Comments

professorbk picture professorbk  路  3Comments

henrymoulton picture henrymoulton  路  3Comments