Mar*_*eyn 7 ios swift swift-package-manager
我正在创建一个简单的库 Swift 包:
import PackageDescription
let package = Package(
name: "dpo-sdk-spm",
platforms: [
.iOS(.v10),
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "dpo-sdk-spm",
targets: ["dpo-sdk-spm"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.2.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: "dpo-sdk-spm",
dependencies: ["Alamofire"]),
.testTarget(
name: "dpo-sdk-spmTests",
dependencies: ["dpo-sdk-spm"]),
]
)
Run Code Online (Sandbox Code Playgroud)
我特别没有创建项目文件,因为在源代码管理中使用该文件是一件痛苦的事情 - 并且不需要开发将在 iOS 应用程序中使用的库,该库将具有必要的构建设置等。我的库已创建使用swift package init --type library以下是结构:
我在节点 iOS V10 下指定platforms,然后将包推送到我的 git 存储库。我将我的 git 帐户添加到 Xcode,创建了一个 App 项目,通过 Xcode 11 的内置 SPM 添加了我的包,没有出现任何问题,但是尝试构建时我得到了:
Showing All Messages The package product 'Alamofire' requires minimum platform version 10.0 for the iOS platform, but this target supports 8.0
我确实在 Package.swift 中指定了平台和版本,为什么构建管道忽略此变量?
| 归档时间: |
|
| 查看次数: |
2687 次 |
| 最近记录: |