πŸ›  Xcode Build Variables

Β·

1 min read

How often do we need to use Xcode build Variables? One of the most used cases is when we need to build a New Run Script Phase, variables like $SRCROOT, $PROJECT_DIR and SWIFT_VERSION are used by many people, but how many of those variables exist? is this a static list? 🀯

So the answer is NO, this is not a static list, in fact, this is based on your project, of course, there is a list of variables that are the same in all projects, but as you know you can define your own Build Settings πŸ˜‹

Let’s create a new Build Setting called MYPROJECT_SETTING with the value of Testing. Just go to Build Settings, find the (+), choose Add User-Defined Setting, and then create the variable, done πŸ’ͺ

1.png

Now how about the other build variables? how we know them, easy peasy, just open terminal, do this.

2.png

You should get a list of all variables.

3.png

That’s all 🧐

Β