Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't name the resources folder "Resources" in my Swift package

When I use resources: [.copy("Resources")] for my Swift package, the bundle can't be built: "Command CodeSign failed with a nonzero exit code" (undle format unrecognized, invalid, or unsuitable).

When I rename the folder to something else, the package can be built without issues.

What's wrong with "Resources"?

like image 257
chkpnt Avatar asked Nov 02 '25 07:11

chkpnt


1 Answers

In my experience, .copy may trigger code-signing operations depending on the platform. Alternatively, you can use .process instead of .copy like this:

resources: [
    .process("Resources"),
]

If you use .process you also need to update the way how you obtain your resource files:

// .copy()
let json = Bundle.module.url(forResource: "Resources/user", withExtension: "json")!

// .process()
let user = Bundle.module.url(forResource: "user", withExtension: "json")!

From the Apple Developer Documentation:

If you apply the process rule to a directory’s path, Xcode applies the rule recursively to the directory’s contents. If no special processing is available for a resource, Xcode copies the resource to the resource bundle’s top-level directory.

like image 159
Nick Avatar answered Nov 05 '25 14:11

Nick



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!