如何将 swift 包置于编辑模式



所以我想在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 中(获取包,以及从哪个目录获取包?

附言这是存储库中的 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"]),
    ]
)

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

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

相关内容

  • 没有找到相关文章

最新更新