Skip to content

Handle copy-style resource bundles preserving folder hierarchy#207

Merged
marcprux merged 1 commit intomainfrom
copy-resources
Mar 10, 2026
Merged

Handle copy-style resource bundles preserving folder hierarchy#207
marcprux merged 1 commit intomainfrom
copy-resources

Conversation

@marcprux
Copy link
Member

@marcprux marcprux commented Mar 10, 2026

Skip currently only handles the resources: [.process("Resources")] style of resource, whereby the contents of the folder are processed in an iOS-style fashion: localization files are transformed, image assets are processed, etc. This works file for plain resources that are to be accessed manually at runtime with Bundle.module.url(forResource: …) (like data and text files), but has the limitation that all folder hierarchies are "flattened", making it impossible to organize assets by sub-folder.

This PR addresses this limitation by adding support for copy-style resources, a la resources: [.process("my-stuff")], whose contents can be accessed with Bundle.module.url(forResource: "my-stuff/some/full/path/file.data"). The caveat is that since the SwiftPM plugin API does not provide any information about the resources of a given SwiftPM module, the information about the resource configuration needs to also be listed in the module's skip.yml, like so:

skip:
  resources:
    - path: 'Resources'
      mode: 'process'
    - path: 'my-stuff'
      mode: 'copy'

The documentation at https://skip.dev/docs/development-topics/#resource-modes will be updated to describe this requirement.

Fixes skiptools/skip-ui#79, fixes skiptools/skip-ui#269

@cla-bot cla-bot bot added the cla-signed label Mar 10, 2026
@marcprux marcprux merged commit 5a8edab into main Mar 10, 2026
9 of 11 checks passed
@marcprux marcprux deleted the copy-resources branch March 10, 2026 15:26
@joshuakcockrell
Copy link

Sweet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants