Home > other >  Firebase productItem names for Swift Package
Firebase productItem names for Swift Package

Time:09-17

I am thinking about writing a Swift Package to help me with my Firebase projects and the signup / authentication etc. process for iOS. When building the package, part of the PackageDescription requires you to list productItems dependencies. This example from the docs shows FirebaseAuth, I want to include Storage, Firestore and the Swift-Beta items as well. Where can I find the correct spelling of those productItem names?

  .target(
    name: "MyTargetName",
    dependencies: [
      .product(name: "FirebaseAuth", package: "Firebase"),
      // ...
    ]
  ),

CodePudding user response:

You can find the product identifiers in Firebase's Package.swift

Here is a sample Package.swift with a complete list of all the products:

// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
  name: "FirebaseSPMTest2",
  platforms: [.iOS(.v11), .macOS(.v10_12), .tvOS(.v10), .watchOS(.v7)],
  products: [
    // Products define the executables and libraries a package produces, and make them visible to other packages.
    .library(
      name: "FirebaseSPMTest2",
      targets: ["FirebaseSPMTest2"]),
  ],
  dependencies: [
    // Dependencies declare other packages that this package depends on.
    // .package(url: /* package url */, from: "1.0.0"),
    .package(name: "Firebase", url: "https://github.com/firebase/firebase-ios-sdk.git", from: .init("8.0.0"))
  ],
  targets: [
    // Targets are the basic building blocks of a package. A target can define a module or a test suite.
    // Targets can depend on other targets in this package, and on products in packages this package depends on.
    .target(
      name: "FirebaseSPMTest2",
      dependencies: [
        .product(name: "FirebaseAnalytics", package: "Firebase"),
        .product(name: "FirebaseAnalyticsWithoutAdIdSupport", package: "Firebase"),
        .product(name: "FirebaseAnalyticsSwift-Beta", package: "Firebase"),
        .product(name: "FirebaseAnalyticsSwift-Beta", package: "Firebase"),
        .product(name: "FirebaseAuth", package: "Firebase"),
        .product(name: "FirebaseAppCheck", package: "Firebase"),
        .product(name: "FirebaseAppDistribution-Beta", package: "Firebase"),
        .product(name: "FirebaseCrashlytics", package: "Firebase"),
        .product(name: "FirebaseDatabase", package: "Firebase"),
        .product(name: "FirebaseDatabaseSwift-Beta", package: "Firebase"),
        .product(name: "FirebaseDynamicLinks", package: "Firebase"),
        .product(name: "FirebaseFirestore", package: "Firebase"),
        .product(name: "FirebaseFirestoreSwift-Beta", package: "Firebase"),
        .product(name: "FirebaseFunctions", package: "Firebase"),
        .product(name: "FirebaseInAppMessaging-Beta", package: "Firebase"),
        .product(name: "FirebaseInAppMessagingSwift-Beta", package: "Firebase"),
        .product(name: "FirebaseInstallations", package: "Firebase"),
        .product(name: "FirebaseMessaging", package: "Firebase"),
        .product(name: "FirebaseMLModelDownloader", package: "Firebase"),
        .product(name: "FirebasePerformance", package: "Firebase"),
        .product(name: "FirebaseRemoteConfig", package: "Firebase"),
        .product(name: "FirebaseStorage", package: "Firebase"),
        .product(name: "FirebaseStorageSwift-Beta", package: "Firebase"),
      ]),
    .testTarget(
      name: "FirebaseSPMTest2Tests",
      dependencies: ["FirebaseSPMTest2"]),
  ]
)

  • Related