Logo for tanaschita.com

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.

Sponsorship logo
Architecture & Design Patterns for iOS
This book is a practical guide to essential architectural principles and design patterns for iOS development. It covers strategies for building maintainable apps with Swift and SwiftUI, including dependency injection, navigation, common patterns, and modularization.
LEARN MORE

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:

Connecting the configuration files
Connecting configuration files.

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 Debug
FEATURE_X_ENABLED = YES

Staging.xcconfig

APP_DISPLAY_NAME = ExampleApp Staging
FEATURE_X_ENABLED = YES

Release.xcconfig

APP_DISPLAY_NAME = ExampleApp
FEATURE_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")
Sponsorship logo
Preparing for a technical iOS job interview
Preparing for a technical iOS Job Interview with over 300 questions & answers. Covering Swift & Objective-C, SwiftUI & UIKit, Combine, HTTP Networking, iOS File System, Core Data, Concurrency with async/await, Security, Automated Testing, Dependency Management, AI & Machine Learning and more.
LEARN MORE
Sponsorship logo
Architecture & Design Patterns for iOS
This book is a practical guide to essential architectural principles and design patterns for iOS development. It covers strategies for building maintainable apps with Swift and SwiftUI, including dependency injection, navigation, common patterns, and modularization.
LEARN MORE
Sponsorship logo
Become a sponsor of tanaschita.com
By publishing an article on different iOS topics every week, tanaschita.com is constantly growing in the developer community and may provide a great audience for you as a sponsor.
CLICK TO LEARN MORE

Newsletter

Image of a reading marmot
Subscribe

Like to support my work?

Say hi

Related tags

Articles with related topics

xcode

ios

swift

Creating and managing multiple app environments in Xcode

Learn how to add and configure debug, staging, and release environments in your iOS app using Xcode.

04 May 2025 · 4 min read

Latest articles and tips

© 2026 tanaschita.com

Privacy policy

Impressum