Working with Xcode configuration files
Learn how to manage different iOS build environments with .xcconfig files.
05 May 2025 · 4 min read
In this article on creating and managing multiple app environments in Xcode, we learned, how to set up environments such as debug, staging, and release when developing an iOS app.
In this article, we'll explore an approach by using Xcode configuration files (.xcconfig) to define environment-specific values.
Let's dive in.

Creating configuration files
The first step is to create a .xcconfig file for each build configuration by selecting File → New → File and using the Configuration Settings File template.
For example, we could create:
By default, each file starts empty.
Connecting configuration files to build configurations
We can activate the configuration files in the Info tab of our project:
Here, we can select the corresponding .xcconfig file for each configuration.
Adding values to configuration files
Now, we can define values such as feature flags or app display names. For example:
Debug.xcconfig
APP_DISPLAY_NAME = ExampleApp DebugFEATURE_X_ENABLED = YES
Staging.xcconfig
APP_DISPLAY_NAME = ExampleApp StagingFEATURE_X_ENABLED = YES
Release.xcconfig
APP_DISPLAY_NAME = ExampleAppFEATURE_X_ENABLED = NO
💡 Note: Don't use quotation marks for strings, even if they contain spaces. Values like YES and NO are treated as strings. Also, Xcode may interpret // in http:// as a comment—use https:/$()/dev.api.com as a workaround.
Accessing configuration values in code
To read these values in code, we first reference them in our Info.plist:
<key>FEATURE_X_ENABLED</key><string>$(FEATURE_X_ENABLED)</string>
Then access them in Swift:
Bundle.main.object(forInfoDictionaryKey: "FEATURE_X_ENABLED")



Newsletter
Like to support my work?
Say hi
Related tags
Articles with related topics
Latest articles and tips



