FooExecutable FooExecutable.resources/Info.plist FooExecutable.resources/FooResource.json libBarLibrary.so BarLibrary.resources/Info.plist BarLibrary.resources/BarImage.png
We can access the resources with the Bundle API:
Bundle.main.path(forResource: "FooResource", withExtension: "json") // .../FooExecutable.resources/FooResource.json let barBundle = Bundle(for: BarLibraryClass.self) barBundle.path(forResource: "BarImage", withExtension: "png") // .../BarLibrary.resources/BarImage.png
This opens the way to the introduction of the Resources story of Swift PM. A first basic implementation could simply copy files found in a
Resources directory of the target source folder to the respective
TargetName.resources folder in the products directory.
Also, if we want to support this type of architecture we will have to start to rely in dynamic linking instead of static linking executable products (otherwise we would have to copy all the input resources to the executable resources directory, with potential collisions).
Finally, this approach would be designed for non-Darwin platforms (Darwin would have to use frameworks for libraries and app bundles? for executables as freestanding bundles are not welcome).