Reputation: 17421
I have 4 build configurations:
Debug
and Release
should link & embed my custom LightTheme.framework
and not the WhiteLabelTheme.framework
.
WhiteLabelDebug
and WhiteLabelRelease
should link and embed my custom WhiteLabelTheme.framework
and not the LightTheme.framework
.
Both of these frameworks have some custom code, localized strings, colors, fonts, and images. We use a different scheme to build each config and submit it to the App Store as a totally different app. However currently both our branded app, and the white label one have both sets of images, fonts, colors, strings, etc. Which really hurts file size.
I can easily weak link both frameworks into the app target, but I can't figure out how to only embed a framework based on the current configuration.
Upvotes: 7
Views: 2388
Reputation: 3177
Go to your target Build Phases and add New Run Script Phase
as the last step.
Here’s what the script could look like:
if [[ ${CONFIGURATION} == "WhiteLabelRelease" ]]; then
rm -R "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/LightTheme.framework"
elif [[ ${CONFIGURATION} == "Release" ]]; then
rm -R "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/WhiteLabelTheme.framework"
fi
When building any of your *Release builds (and Archiving for submission), the script will remove a corresponding framework. It will leave them in place when debugging.
Upvotes: 8