I've an Xcode iOS project with two targets. Each of these targets includes a third target which is an iOS Extension (Widget). Is there a way to update the Widget build settings based on the choosen build target?
I've already setup some pre-actions in the Xcode target build scheme to update the Info.plist
file of the Widget with the parent bundle identifier:
# BundleIdentifier
bundleIdentifier=${PRODUCT_BUNDLE_IDENTIFIER}
# Widget Identifier
widgetIdentifier="WidgetName"
# updating BundleIdentifier in widget InfoPlist
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $bundleIdentifier.$widgetIdentifier" "${SRCROOT}/${widgetIdentifier}/ConfigFiles/Info.plist"
My two main targets bundle identifiers are com.company.firstname
and com.company.secondname
. As you can see, I was able to update the Info.plist
of the Widget, specifically the CFBundleIdentifier
key.
Can i do something similar to this to update the build settings parameter of the Widget Product Bundle Identifier
? I need to update the Widget build settings to be something like com.company.firstname.widgetname
or com.company.secondname.widgetname
based on the current target.