Skip to content
Samantha Marshall edited this page Jun 19, 2016 · 3 revisions

for

The for keyword is used to declare the assignment of values to a build setting. This keyword is paired with an identifier to group value assignments. There are two flavours of this, first being the direct assignment which uses the special * identifier:

setting OTHER_LDFLAGS {
	for * {
		-lz
	}
}

This will generate the following statement in the .xcconfig file:

OTHER_LDFLAGS = -lz

The other method is by supplying an identifier to use as part of variable substituion:

setting OTHER_LDFLAGS {
	for Debug {
		-lz,
		-framework "Reveal"
	}
	for Release {
		-lz
	}
}

Which will generate the following in the .xcconfig file:

OTHER_LDFLAGS_Debug = -lz -framework "Reveal"
OTHER_LDFLAGS_Release = -lz
OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(CONFIGURATION))

To modify the variable that gets used for substition, please look at the documentation for either variable substitution or the use keyword.

To perform an empty assignment, define the for statement but do not include the curly brakets in the declaration:

setting PROVISIONING_PROFILE {
	for Debug
	for Release {
		App_Store_Distribution_Profile
	}
}

For more information please see the Automatic Value Assignment page.

Reminder: Build settings can either contain if style assignments or for style assignemnts, but not both in the same setting declaration.

Clone this wiki locally