The hidden value of Xcode schemes

Xcode schemes are usually used to target multiple platforms.

While this is a viable way to build your code for all the platforms available in the Apple ecosystem, they could introduce complications due to their maintenance — if you want to know more please refer to Samantha Demi’s fantastic blog post on Using Xcode Targets.

Xcode schemes are very powerful instruments in your tool belt, even you are not using them for different targets. In particular, they could be used to define use cases in order to test your app under specific scenarios.

For example, if you need to verify your app deals correctly with Italian localisation, you can create a new scheme where the application language is Italian. Another use case could consist on postponing the executable to be launched when you are testing different deep linking behaviors of your app.

The creation of a new scheme can be performed in few steps. Select the scheme, created by Xcode for you, and choose Manage Schemes… option.

Xcode displays a modal dialog where you have different options. Select the scheme you are interested in (it should highlighted in blue) and, after clicking on the little gear on the bottom left, choose Duplicate. This option allows you to duplicate a scheme from an existing one.

Once done, Xcode prompts with a different dialog where you can specify the desired behavior.

First of all change the name of this new scheme to something more related to your use case, e.g. MyAmazingFramework-Localisation.

Then, choose the option (or a combination of options) the scheme needs to have. For example, if your intent is to change the application language of your application, switch to the Options tab, locate System Language and select the language from the dropdown list. Click Close to apply the changes.

Repeat the creation steps for every use case you need to cover.

Using the new customised scheme is simple as setting it as the active one. If it’s not the case, just choose it among the available schemes in Xcode and run the application as normal.

And that’s it! I hope with this brief entry I’ve explained how schemes can be an added value for your daily work.

If you have any questions or comments, please let’s discuss here!