I now generate a colors.xcassets catalog from a variable json file. It is a buildTool that runs whenever the json changes.
This correctly puts the folder into the pluginWorkingDirectory but when I build it there seams to be no way to add this resource as a resource to the library I'm building?
I get the warning when I use swift 5.6
no rule to process file '~/Library/Developer/Xcode/DerivedData/<#package#-uuid/SourcePackages/plugins/<#package#>.output/<#library#>/<#pluginName#>/color-lizard.xcassets/colorGreen40/Contents.json' of type 'file' for architecture 'arm64'
I now managed to fix all issues using swift 5.7 and have a working example
The problem remains that you apparently have to use a prebuild command that is ran all the time. I would like to ran this only when files in the target are changed. But as far as I understand it this is only possible using a build command?
@NeoNacho should I create a feature request for that or is there another way to do the above?
Ok so I seam to have fixed my issue. My problem was I was feeding a assets.xcassets catalog file by file to the output files of the build command. This caused duplicate build commands as everything is called Content.json in the end.
If anybody else struggles with this I created a minimal swift package with a SwiftUI view that loads colors from generated assets here