Swift包管理器(SPM):导入库时出错

时间:2017-10-17 21:40:14

标签: swift

导入我创建的库时遇到问题。

这是Package.swift的{​​{1}}:

executable

当我在import PackageDescription let package = Package( name: "PayBackCodingChallenge", dependencies: [ .package(url: "../NumberChecker", from: "1.0.0"), ], targets: [ .target( name: "PayBackCodingChallenge", dependencies: []), ] ) 尝试import NumberChecker时,我收到以下消息:没有这样的模块'NumberChecker'

main.swift

我的NumberChecker库位于与PayBackCodingChallenge相同级别的目录中并正确编译。可能是什么问题?

提前致谢!

1 个答案:

答案 0 :(得分:2)

您应该将NumberChecker作为依赖项添加到PayBackCodingChallenge

... targets: [ .target( name: "PayBackCodingChallenge", dependencies: ["NumberChecker"]), ] ...