SPM 包找不到导入 SwiftUI 我已经我的项目

问题描述

我在我的项目中使用了我自己制作的 Swift Package Manager 数据包 (Here is the Github Link),我测试了该数据包,它确实可以正常工作,并且已经运行了几天,但是当我尝试存档应用程序将其发布到 TestFlight 它开始显示这些对我没有任何意义的错误

enter image description here

我已经

我的项目

  • 使用 iOS14
  • 有目标设置为 iOS14 的 Pods
  • 使用 SwiftUI

解决方法

结果我必须指定支持 SwiftUI 的 iOS、TvOS、watchOS 和 macOS 版本,在我的情况下,我主要使用每个平台的最新版本,因为我的库需要它,但对于 SwiftUI 是最早支持的版本是iOS13

let package = Package(
    name: "SwiftUISnackbar",platforms: [
            .macOS(.v11),.iOS(.v14),.tvOS(.v14),.watchOS(.v7)
        ],products: [
        // Products define the executables and libraries a package produces,and make them visible to other packages.
        .library(
            name: "SwiftUISnackbar",targets: ["SwiftUISnackbar"]),],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 this package depends on.
        .target(
            name: "SwiftUISnackbar",dependencies: []),.testTarget(
            name: "SwiftUISnackbarTests",dependencies: ["SwiftUISnackbar"]),]
)