Swift Template uses mustache -- Logic-less templates.
A typical Mustache template:
Hello {{name}}
You have just won ${{value}}!
{{#in_ca}}
Well, ${{taxed_value}}, after taxes.
{{/in_ca}}
Tags are indicated by the double mustaches. {{person}} is a tag, as
is {{#person}}. In both examples, we'd refer to person as the key
or tag key. Let's talk about the different types of tags.
The most basic tag type is the variable. A {{name}} tag in a basic
template will try to find the name key in the current context. If
there is no name key, nothing will be rendered.
All variables are HTML escaped by default. If you want to return
unescaped HTML, use the triple mustache: {{{name}}}.
You can also use & to unescape a variable: {{& name}}. This may be
useful when changing delimiters (see "Set Delimiter" below).
By default a variable "miss" returns an empty string.
Template:
* {{name}}
* {{age}}
* {{company}}
* {{{company}}}
Sections render blocks of text one or more times, depending on the value of the key in the current context.
A section begins with a pound and ends with a slash. That is,
{{#person}} begins a "person" section while {{/person}} ends it.
The behavior of the section is determined by the value of the key.
False Values or Empty Lists
If the person key exists and has a value of false or an empty
list, the HTML between the pound and slash will not be displayed.
Template:
Shown.
{{#nothin}}
Never shown!
{{/nothin}}