-
Couldn't load subscription status.
- Fork 35
Description
I'm trying to use Scipio to make XCFramework for Composable Architecture. At first, it seemed to be working fine, as I was able to use the generated XCFramework in Xcode project. However, I can't use Swift Macros that Composable Architecture exposes. When trying to do so, I get the following error:
External macro implementation type 'ComposableArchitectureMacros.ReducerMacro' could not be found for macro 'Reducer()'
I'm unsure how to debug the issue, but I found that Tuist does some extra work when creating Xcode targets from swift packages. It adds an additional build phase for each swift package that contains macros. The build scheme looks like this:
Copy Swift Macro executable into $BUILT_PRODUCT_DIR
# This build phase serves two purposes:
# - Force Xcode build system to compile the macOS executable transitively when compiling for non-macOS destinations
# - Place the artifacts in the "Debug" directory where the built artifacts for the active destination live. We default to "Debug" because otherwise the Xcode editor fails to resolve the macro references.
if [[ -f "$BUILD_DIR/$CONFIGURATION/ComposableArchitectureMacros" && ! -f "$BUILD_DIR/Debug$EFFECTIVE_PLATFORM_NAME/ComposableArchitectureMacros" ]]; then
mkdir -p "$BUILD_DIR/Debug$EFFECTIVE_PLATFORM_NAME/"
cp "$BUILD_DIR/$CONFIGURATION/ComposableArchitectureMacros" "$BUILD_DIR/Debug$EFFECTIVE_PLATFORM_NAME/ComposableArchitectureMacros"
fi
Input Files: $BUILD_DIR/$CONFIGURATION/ComposableArchitectureMacros
Output Files: $BUILD_DIR/Debug-$EFFECTIVE_PLATFORM_NAME/ComposableArchitectureMacros
I think the above build phase is crucial for the Swift Macros to work, when integrated in a different way than through SPM.
It would be great to use Scipio for generating XCFrameworks, and being able to use Swift Macros. I'm happy to help with further investigation and research possible solutions, but I'm not even sure where to start at the moment.