我的应用程序中有 2 个软件包,
MSExtension -> Contains some func related to the view controller, views, and labels, etc...
CustomUIpackage -> Standard custom UI like Button, label, and Radio buttons
CustomUIPackage 依赖于 MSExtension,用于访问 Button 和 Label 的一些常见功能,
因此,我已将 MSExtension 导入到 CustomUIPackage 和 App 中。 如果我为模拟器构建并运行它按预期工作,我就能够构建并执行该应用程序。
我能够为模拟器以及通用 iOS 设备构建项目,但是当我尝试存档项目时,出现错误
No such module MSExtension
错误出现在导入 MSExpension 包的 CusomUIPackage 中
还有其他更好的方法可以实现这一目标吗?如有任何帮助,我们将不胜感激。
最佳答案
阅读有关 swift 包管理器并添加来自 link 的依赖项后
我通过添加依赖项列表及其路径来更改 Package.swift。我能够存档该应用程序。
之前,未指定 swift 包管理器的依赖项。
import PackageDescription
let package = Package(
name: "MSUIElements",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "MSUIElements",
targets: ["MSUIElements"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
// No depency path added
],
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: "MSUIElements",
dependencies: []), // dependcy name not mentioned
.testTarget(
name: "MSUIElementsTests",
dependencies: ["MSUIElements"]),
]
)
之后
import PackageDescription
let package = Package(
name: "MSUIElements",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "MSUIElements",
targets: ["MSUIElements"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(path:"../MSExtension")
],
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: "MSUIElements",
dependencies: ["MSExtension"]),
.testTarget(
name: "MSUIElementsTests",
dependencies: ["MSUIElements"]),
]
)
关于ios - 没有这样的模块 Swift 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63638226/