Skip to content

Instantly share code, notes, and snippets.

@iTonyYo
Last active November 7, 2023 09:41
Show Gist options
  • Save iTonyYo/6dd5627a7f89ec8a11bde430dfc5dd79 to your computer and use it in GitHub Desktop.
Save iTonyYo/6dd5627a7f89ec8a11bde430dfc5dd79 to your computer and use it in GitHub Desktop.
Create xcframework. create this file, and `chmod 755 xcframework.shell` make this file excutable.
#!/bin/bash
iosFrameworksDir="./build/Park.ios.xcarchive/Products/Library/Frameworks"
simulatorFrameworksDir="./build/Park.iphonesimulator.xcarchive/Products/Library/Frameworks"
outDir="./build"
outputSuffix="xcframework"
for iosFramework in "$iosFrameworksDir"/*
do
# Check if the item is a directory
if [ -d "$iosFramework" ]; then
iosFrameworkName=$(basename "$iosFramework")
simulatorFramework="$simulatorFrameworksDir/$iosFrameworkName"
if [ -d "$simulatorFramework" ]; then
out="$outDir/${iosFrameworkName%.*}.$outputSuffix"
# Execute the xcodebuild command for each framework
xcodebuild -create-xcframework \
-framework "$iosFramework" \
-framework "$simulatorFramework" \
-output "$out"
echo "XCFramework created for ${iosFrameworkName%.*}.$outputSuffix"
else
echo "Simulator framework not found for $iosFrameworkName"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment