将 SpriteKit 场景添加到 Xcode 上的 Swift Playground App 项目?

发布于 2025-01-19 10:13:45 字数 197 浏览 4 评论 0 原文

我想在Xcode上的Swift Playground App Project(.swiftpm)中添加一个SKSCENE(.SK),但是当我将其添加到项目导航器中时,我会收到以下错误:

找到1个未经用手的文件;明确将它们声明为资源,或将其排除在目标之外,

如何使其在不添加其他Swift软件包中的情况下使其正常工作?

I want to add an SKScene (.sks) to my Swift Playground App project (.swiftpm) on Xcode but when I add it to the project navigator I get the following error:

found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target

How do I make it work without adding other Swift Packages to the project?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城缀染半城烟沙 2025-01-26 10:13:45

我遇到了同样的问题,我到处搜索但没有找到解决方案。

我在 Playgrounds 上创建了新的应用程序,并通过右键单击 Playgrounds 项目文件夹,使用“显示包内容”查看应用程序根文件夹中的“Package.swift”文件。

经过比较,我发现目标中缺少“资源”标签。我添加了资源标签并分配了“资源”文件夹名称,这解决了问题。

targets: [
    .executableTarget(
        name: "AppModule",
        dependencies: [
            .product(name: "Lottie", package: "lottie-ios")
        ],
        path: ".",
        resources: [
            .process("Resources")
        ]
    )
]

检查“Package.swift”文件中的目标是否缺少以下代码。

资源:[
.process("资源")]

I had the same problem and I searched everywhere but did not find the solution.

I created new App on Playgrounds and looked into the "Package.swift" file in the root folder of the App using "Show Package Contents" by right clicking on Playgrounds project folder.

On comparing I found that "resources" tag was missing from targets. I added resources tag and assigned the "Resources" folder name and that fixed the issue.

targets: [
    .executableTarget(
        name: "AppModule",
        dependencies: [
            .product(name: "Lottie", package: "lottie-ios")
        ],
        path: ".",
        resources: [
            .process("Resources")
        ]
    )
]

Check if following code is missing from targets in "Package.swift" file.

resources: [
.process("Resources") ]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文