banner



How To Change App Icon From Xcode 9

How to Leverage Xcode's Build Configurations

Change iOS app icon for different build types

Zafar Ivaev

In this tutorial, we will learn how we can build three versions of an iOS app — debug, alpha, and release. We will also use different app icon for each for these to make it easier to differentiate them.

This is what you will have learned by the end of the article:

  • How to create build configurations right in Xcode.
  • How to reference three sets of an app icon in your build configurations.
  • How to install several build types of the same app on your device.

Without further ado, let's get started.

Let's Start

We begin with an empty project called "App":

Our first step is to tap on the "App" under the "Project" title:

Here we see that Xcode has already provided us with the "Debug" and "Release" configurations. Our task is to create an "Alpha" configuration:

As we can see, we created a duplicate of the "Release" configuration and named it "Alpha". Next, we need to add app icon sets in the Assets.xcassets catalog.

First, let's create a new folder for app icons:

Let's move the existing "AppIcon" image set to the folder (we will later use it for the "Release" build configuration):

We need to create two more icons, one for "Debug" and one for "Alpha":

After creating the icons, naming them "AppIcon.dev" and "AppIcon.alpha", and moving them to the "AppIcons" folder, we have the following:

Next, we add the actual images with according resolutions to each of the sets:

It's time to learn how we can reference the needed icon set for each of the build configurations.

Referencing App Icons

First, we need to tap on the "App" under the "Targets" and select "Build Settings" as follows:

Next, we type "App Icon" in the search field and expand the found "Asset Catalog App Icon Set Name" category:

Here we will need to reference the required icon set for each of the build configs. Let's adjust the names as follows:

Now, if we build, run, and minimize the app, we will see that it uses the "Debug" build configuration:

Now the question is: how can we run different build configurations? The answer is adjust the scheme so that it uses a different build configuration each time we run the app.

Running Different Build Types

To adjust the scheme, we need to tap on this button:

Next, select "Edit Scheme" and this popup will appear:

If we expand the "Build Configuration" category, we will see all three available build configs:

Let's select "Release", close the popup and run the app again. When we minimize the app, we will see that it correctly used the "Release" icon set:

That's great! However, we wanted to have three versions of our app installed on the same device. Let's tackle this final task next.

Installing Several Build Types

The way to achieve that is by using a different Bundle Identifier for each of the build configs. Just like we did it with app icons, let's search for the "Bundle Identifier" in the target's build settings:

We see that the app currently uses the same bundle id for each of the build types. That's why if we simply change the build type and re-run the app, it will update the existing app, and not create a new one. Let's update the bundle identifiers like this:

Now, let's try to run the release version of the app. Change the build config to "Alpha":

After building, running, and minimizing the app, we see that we achieved what we wanted:

How To Change App Icon From Xcode 9

Source: https://levelup.gitconnected.com/how-to-leverage-xcodes-build-configurations-5516ac3743e4

Posted by: hannahofue1976.blogspot.com

0 Response to "How To Change App Icon From Xcode 9"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel