Swift 包清单 属性 'defaultLocalization' 未设置
Swift Package manifest property 'defaultLocalization' not set
试验 Swift 个包,我创建了一个新包。来自现有 Xcode 项目框架目标的源文件和资源已移至新结构中。
正在尝试构建,脚本显示错误:
manifest property 'defaultLocalization' not set; it is required in the presence of localized resources
如何解决这个问题,以便我可以创建一个 Swift 包?
这在 WWDC2020 session 10169 中有解释。
在视频进行到大约 11 分半钟时,Apple 工程师 Developer Tools Anders Bertelrud 介绍了主题。显示了一个使用 Xcode 12 将默认本地化参数添加到程序包清单的示例。
This declares the language I'm using during development and will be
used as the fallback localization at runtime if no better match is
available. This is needed for any package that contains resources.
包含defaultLocalization
参数的清单示例如下:
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "MyPackageUI",
defaultLocalization: "en",
platforms: [
.iOS(.v13)
],
products: [
.library(
name: "MyPackageUI",
targets: ["MyPackageUI"]),
],
targets: [
.target(
name: "MyPackageUI",
dependencies: []),
.testTarget(
name: "MyPackageUITests",
dependencies: ["MyPackageUI"]),
]
)
试验 Swift 个包,我创建了一个新包。来自现有 Xcode 项目框架目标的源文件和资源已移至新结构中。
正在尝试构建,脚本显示错误:
manifest property 'defaultLocalization' not set; it is required in the presence of localized resources
如何解决这个问题,以便我可以创建一个 Swift 包?
这在 WWDC2020 session 10169 中有解释。
在视频进行到大约 11 分半钟时,Apple 工程师 Developer Tools Anders Bertelrud 介绍了主题。显示了一个使用 Xcode 12 将默认本地化参数添加到程序包清单的示例。
This declares the language I'm using during development and will be used as the fallback localization at runtime if no better match is available. This is needed for any package that contains resources.
包含defaultLocalization
参数的清单示例如下:
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "MyPackageUI",
defaultLocalization: "en",
platforms: [
.iOS(.v13)
],
products: [
.library(
name: "MyPackageUI",
targets: ["MyPackageUI"]),
],
targets: [
.target(
name: "MyPackageUI",
dependencies: []),
.testTarget(
name: "MyPackageUITests",
dependencies: ["MyPackageUI"]),
]
)