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?
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.
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.
In XCode 5 this has changed slightly.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With