Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create variables for use in Xcode build settings values?

Tags:

xcode4

xcode5

XCode has a number of built-in variables that are used for convenience in Build Settings, for example "$(PRODUCT_NAME)" or "$(CURRENT_ARCH)".

Can I define my own variables? How / where?

like image 644
Ben Flynn Avatar asked Jun 01 '12 16:06

Ben Flynn


People also ask

How do you set variables in Xcode?

Goto "Apple LLVM - Preprocessing" section in Build Settings of your project and you can add variables like LOGGING=1 and which can be accessed from code as #if LOGGING . It seems that on Xcode 12.5, the Editor menu doesn't work, but the top-right add button next to search bar does now.

How do I change my build settings in Xcode?

Choose the project in the Project Navigator on the left. Select the Configurations target from the Targets section and click the Build Settings tab at the top. The Build Settings tab shows the build settings for the Configurations target. It's possible to expand this list with build settings that you define.


2 Answers

In XCode 5 this has changed slightly.

  1. Select the project or target in the left side of the editor
  2. Go to the Editor menu in the top menu bar
  3. Select "Add Build Setting" and then "Add User-Defined Build Setting"

enter image description here

like image 199
Jon Deokule Avatar answered Sep 30 '22 02:09

Jon Deokule


Create a user-defined build setting. To create one in Xcode 4 select your project from the project navigator to open the project editor. Select your project or target from the left side of the editor. Click the Build Settings button at the top of the editor. Click the Add Build Setting button at the bottom of the editor and choose Add User-Defined Setting.

like image 31
Swift Dev Journal Avatar answered Sep 30 '22 02:09

Swift Dev Journal