This was really useful @andras . I've added this as a custom build step for my framework target that consumes Swift Packages with resources:
cp -RL "${BUILT_PRODUCTS_DIR}"/*.bundle "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
This has 2 differences to yours:
-
I've used the
-Lflag tocp. When doing anarchiveof the framework, the.bundles inBUILT_PRODUCTS_DIRare symbolic links instead of the actual bundles. This flag makes sure the destination of the link is copied, instead of the link itself. -
I've used
UNLOCALIZED_RESOURCES_FOLDER_PATHas the destination path. For iOS (slim) frameworks, this is just the root of the framework. I think for macOS, it would be theResourcesdirectory within the framework.