Add resources in Swift Playgrounds 4

How to link binary resources folder in package.swift file from Swift Playgrounds. Given that I cant manually edit the package.swift file. How do I navigate to resolve this? Currently, my targets looks like this:

targets: [
     .executableTarget(
              name: "AppModule",
              path: "."
     )
]

I would like to link the resources folder like this:

targets: [
     .executableTarget(
              name: "AppModule",
              path: ".",
              resources: [
                     .process("Resources")
              ]
     )
]

Playground Version: 4.3

Please let me know.

I am few hours away from the swift student challenge submission.

Kindly acknowledge.

PLEASE HELP!!!

The Resources folder should be automatically created when you add a resource file such as a sound file, or a CoreML model, and you don't need to modify the Package.swift file. To add files to your Resources folder, you can drag and drop them or go to File > Add File, and select your resource.

If your question is how to add another folder that works as a resource folder, you can add it in the resources part of Package.swift like this:

targets: [
     .executableTarget(
              name: "AppModule",
              path: ".",
              resources: [
                     .process("Resources"),   /* don't forget the comma */
                     .process("OtherFolder") // the folder you want to add as a resources folder (replace OtherFolder with the desired name)
              ]
     )
]

If you're asking how to edit the Package.swift file, I'm not sure if you can open it in Playgrounds. On macOS, you can right click on the App Playground > Show In Finder to get to its location, and then right click > show contents on the app to see the its files, including the Package.swift file.

To use your resource files, you need to use something like let url = Bundle.main.url(forResource: "ResourceFile", withExtension: "txt") in combination with something else, depending on what you want to use it for.

Add resources in Swift Playgrounds 4
 
 
Q