Swift NIO 传输服务无法在 Xcode 13 beta 的 PM 中解析

Can't get Swift NIO Transport Services to resolve in PM in Xcode 13 beta

我正在 Xcode 13 Beta 中试用包管理器。我有 Nimble 可以解决并可用于我的测试,但我无法解决 Swift NIO 传输服务。

最初我试过这个:

    dependencies: [
        .package(url: "https://github.com/apple/swift-nio-transport-services.git", branch: "main"), // from: "1.0.0"),
    ],
    targets: [
        .target(
            name: "Simulcra",
            dependencies: ["swift-nio-transport-services"],
        ),

这会产生错误“未找到包 'simulcra' 目标 'Simulcra' 所需的产品 'swift-nio-transport-services'。”即使包会解析并在 Xcode 中可见。所以我尝试了这个:

    dependencies: [
        .package(url: "https://github.com/apple/swift-nio-transport-services.git", branch: "main"), // from: "1.0.0"),
    ],
    targets: [
        .target(
            name: "Simulcra",
            dependencies: ["NIOTransportServices"],
        ),

这给了我错误“目标 'Simulcra' 中的依赖项 'NIOTransportServices' 需要显式声明;使用 '.product(name: "NIOTransportServices", package: "swift-nio-transport-services")" 然后我这样做了:

    dependencies: [
        .package(name: "NIOTransportServices", url: "https://github.com/apple/swift-nio-transport-services.git", branch: "main"), // from: "1.0.0"),
    ],
    targets: [
        .target(
            name: "Simulcra",
            dependencies: ["NIOTransportServices"],
        ),

这给了我错误“'simulcra' 对 'https://github.com/apple/swift-nio-transport-services.git' 的依赖有一个明确的名称 'NIOTransportServices',它与为 'https://github.com/apple/swift-nio-transport-services.git' 设置的名称 'swift-nio-transport-services' 不匹配“

现在我不知道下一步该怎么做。有什么想法吗?

哦,我明白了。刚刚意识到我误读了错误,我需要将依赖项更改为:

    dependencies: [
        .package(url: "https://github.com/apple/swift-nio-transport-services.git", branch: "main"), // from: "1.0.0"),
    ],
    targets: [
        .target(
            name: "Simulcra",
            dependencies: [.product(name: "NIOTransportServices", package: "swift-nio-transport-services")],
        ),

没意识到我可以使用 .product(...) 指定依赖关系。 SPM 对我来说是新手:-)