Skip to main content

Variable Reference

Inserts the value provided in another variable placeholder, optionally applying the selected transformation.

You can reference the following placeholder types:

Parameters​

1️⃣ Referenced Variable​

The Field Title of the variable that you want to reference.

2️⃣ Transformation (default: None)​

The transformation to be applied to the referenced value.

See Text Transformations.

Syntax​

{@variable-reference|First Name|Upper Case@}

This placeholder takes the value from the variable with Field Title equal to First Name and applies the Upper Case transformation to it.

Notes​

Alternatively, if you don't need transformations, you can reuse some placeholders by just copy-pasting their generated code. E.g. if you paste a Text Variable or Selectable Date placeholder twice, you will have to provide the value just once and it will be automatically inserted in all places.

Use Cases​

This placeholder is useful when you want to reuse a text variable value in multiple places in your snippets and optionally apply a transformation to it.

Example 1​

You want to reuse the same name in different parts of your template, which requires the name to be in different formats.

Dear Supplier,

Could you please send us the most recent price list for {@text|Product|apples@}?

{@variable-reference|Product|Start Upper Case@} are in high demand and we need
to update our prices.

Best regards,
Purchasing Department

Example 2​

You want to create a snippet that generates a template to test a class with the given name. In this case, usually you need to reuse the class name in different formats.

final class {@text|Class@}Tests: XCTestCase {
private var {@variable-reference|Class|Start Lower Case@}: {@variable-reference|Class|Start Upper Case@}!

override func setUp() {
super.setUp()

{@variable-reference|Class|Start Lower Case@} = {@variable-reference|Class|Start Upper Case@}()
}
}

Video Example​