Let’s say we would like to share some Xcode environment variables across multiple targets in a project configured with CocoaPods. For instance, we would to use the same app version number across our development and distribution targets in order not to retype the same values for each version bump over and over again.
The solution I opted for was to:
2. In the project settings, change the configuration settings file to “SharedSettings”
3. In settings file, in order to preserve your pod configuration, add
#include "Pods/Pods.xcconfig"
VERSION_NUMBER = 3.0
And it’s done: now you can use the environment variable $(VERSION_NUMBER)
, even in your plist file, without breaking the compatibility with CocoaPods. As a result, any future “pod install” will not break the configuration you have just created.