admin管理员组

文章数量:1122846

I have a mono cocoapods repo, that host all our libraries. I'm in the process of adding support for Apple SPM. Everything is working on the package.swift configuration. But, I trying to have the same behavior as Firebase SPM package.

The behavior is when a someone want to add our packages, all the package are optional and with the "add to target" set to none in Xcode, to offer full control on what the user want to import (See image). Any idea on what am I missing ?

Firebase adding process

I've tried having target wrappers, a dummy empty package with no dependencies as the main product, but nothing seems to be working

Here's a obfuscated package.swift

// swift-tools-version: 5.9
import PackageDescription

let package = Package(
    name: "MyPackages",
    platforms: [.iOS(.v13)],
    products: [
      .library(
        name: "MyPackageA",
        targets: ["MyPackageA"]
      ),
      .library(
        name: "MyPackageB",
        targets: ["MyPackageB"]
      )
    ],
    dependencies: [
    ],
    targets: [
      .target(
        name: "MyPackageA",
        dependencies: ["MyCorePackageBinary", "MyPackageABinary"],
        path: "MyPackageAPath"
      ),
      .target(
        name: "MyPackageB",
        dependencies: ["MyCorePackageBinary", "MyPackageBBinary"],
        path: "MyPackageBPath"
      ),      
      .binaryTarget(
        name: "MyCorePackageBinary",
        path: "MyPath/MyCorePackageBinary.xcframework"
      ),
      .binaryTarget(
        name: "MyPackageABinary",
        path: "MyPathA/MyPackageABinary.xcframework"
      ),
      .binaryTarget(
        name: "MyPackageBBinary",
        path: "MyPathB/MyPackageBBinary.xcframework"
      )
    ]
)

本文标签: xcodeHow can I make all my Swift Package Manager package optional like Firebase offersStack Overflow