如何将快速包装放入“编辑模式”?

时间:2019-06-17 08:18:41

标签: swift-package-manager xcode11

所以我想在MacOS 10.15 Beta(19A471t)的Xcode 11.0 beta(11M336w)中以快速包的形式编辑一些文件。

让我们以https://github.com/AndyQ/NFCPassportReader为例。

它有一个示例应用程序,该应用程序使用来自GitHub的存储库。 假设我要进行一些源代码更改。如何告诉系统我要编辑软件包?

我在命令行上尝试了“ swift package edit NFCPassportReader”。

  1. 如果从示例应用程序的根文件夹中运行它,则会得到“ error: root manifest not found

  2. 如果我从软件包的根目录运行它,则会得到“ error: Could not find dependency 'NFCPassportReader'

我需要采取什么步骤才能使软件包处于编辑模式(在Xcode 11中),以及从哪个目录进入?

P.s。这是仓库中的Package.swift文件

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

import PackageDescription

let package = Package(
    name: "NFCPassportReader",
    platforms: [.iOS(.v13)],
    products: [
        // Products define the executables and libraries produced by a package, and make them visible to other packages.
        .library(
            name: "NFCPassportReader",
            targets: ["NFCPassportReader"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.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 which this package depends on.
        .target(
            name: "NFCPassportReader",
            dependencies: []),
        .testTarget(
            name: "NFCPassportReaderTests",
            dependencies: ["NFCPassportReader"]),
    ]
)

1 个答案:

答案 0 :(得分:1)

如果在本地克隆包并将其拖到项目或工作区中,则该本地副本将覆盖被引用到的任何地方(只读)远程依赖项。然后,您可以根据需要编辑包的本地副本。

关于WWDC2019创建Swift软件包的视频,您可以在大约23分钟的时间里看到有关此工作流的更多信息:https://developer.apple.com/videos/play/wwdc2019/410/