Adding SpriteKit scene to Swift Playground App project on Xcode?
Asked Answered
L

1

6

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?

Legend answered 6/4, 2022 at 19:53 Comment(1)
I had the same problem. Can't add resources' usual file types on Swift Playgrounds App Project.Biagio
C
2

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") ]

Corbin answered 28/5, 2022 at 14:41 Comment(1)
Thanks! I also had the same issue and none of the other solutions worked.Strychnic

© 2022 - 2024 — McMap. All rights reserved.