Introduction to Xcode Build Configurations

This is a walk-through article by one of ClinkIT Solutions’ lead mobile developers providing the steps on how to set up Xcode build configurations for differentiating app names and icons.

A build configuration is a collection of settings used when building your application. With build configurations, we developers can define different application environments. These include settings as simple as using different app icons, or as advanced as differentiating API endpoints to connect with.

A typical production level application contains, but is not limited, to these environments: 

  1. development – serves as workstations for developers
  2. testing – serves as a testing grounds for QAs and external testers
  3. production – environment to which end users interact with 

Each of these environments would have its own corresponding settings. For example, different API endpoints are used when working with your development environment versus your testing and production environment. Defining separate build configurations for each of these environments will help us preconfigure corresponding settings with ease and prevent us from making unnecessary mistakes when building our applications.

Xcode Build Configurations

By default, a newly created project in Xcode will have two configurations set: Debug and Release. You can access this information by selecting the project file in the navigation area. Build configurations are listed under the Info tab. You can create a new build configuration by clicking the + icon and selecting an existing build configuration for duplication.

Xcode Configuration Setup

Goals

As an introduction, we will keep it simple and define different app names and app icons for both of the preexisting environments.

With the Debug build configuration, let’s name our application Clink Debug with a Gray app icon; and for the Release build configuration, let’s have it named as Clink with a Yellow icon.

Differentiating Application Names

Let’s start off by differentiating application names. If you open your project’s Info.plist file, you will see that we have a property called Bundle name. This property defines the display name of your application that we want to configure. Currently, our application’s bundle name is referenced to the PRODUCT_NAME build setting.

xcode-img-2

Go to your application’s Build Setting by clicking the project file in the navigation area, select your active target, and select Build Settings. Here, we can see a set of predefined build settings our project currently uses.

** Take note that the following changes we make can be done through the project level build settings as well.

xcode-img-3

Use the search bar and look for PRODUCT_NAME. Expand the setting called Product Name. Here, we can see that we can define different values for the Debug and Release build configurations.

xcode-img-4

Let’s go ahead and change those fields to our intended values.

xcode-img-5

Differentiating App Icons

After creating two separate app icons in your Assets folder, we basically just do the same steps we did with when differentiating our application’s name.

xcode-img-6

Go to Build Settings and search for Asset Catalog App Icon Set Name.

xcode-img-7

Fill in the appropriate values.

xcode-img-8

Testing Building Configurations

Last thing to do is check out the effects of the changes we made. We can select which build configuration to use by editing our current scheme. This can be accessed in the Xcode Toolbar beside the run and stop buttons.

xcode-img-9

In the Edit Scheme menu, we can select the build configuration we want to use for each build action. For now, let’s focus on changing the Build configuration on Run.

xcode-img-10

It’s currently set to our Debug Configuration. Let’s go ahead and run our application. Just as we have configured for Debug, we have our app with the name Clink Debug and a gray icon.

xcode-img-11

Now, let’s change our build configuration to use the Release configuration.

xcode-img-12

Next Steps

This article only focused on the basic and fundamental aspect of build configurations. As we look more into build configuration such as configuration sets and build schemes, we can create more intricate settings that would fit our needs within development cycles. Get the latest insights on developer best practices, technologies and solutions for businesses here.

Need help with application development or other development services? Schedule a free consultation with us.