TemplateVariable
public class TemplateVariable : GenericVariable<String, StringTemplateInterpreter>
A special kind of variable that is used in case of StringTemplateInterpreters. It does not convert its content using the interpreterForEvaluatingVariables but always uses the StringTemplateInterpreter instance.
It’s perfect for expressions, that have a body, that needs to be further interpreted, such as an if or while statement.
-
No changes compared to the initialiser of the superclass
Variable, uses the same parametersDeclaration
Swift
public override init(_ name: String, options: VariableOptions = [], map: @escaping VariableMapper<String, StringTemplateInterpreter> = { $0.value as? String })Parameters
nameGenericVariables have a name (unique identifier), that is used when matching and returning them in the matcher.optionsOptions that modify the behaviour of the variable matching, and the output that the framework provides
mapIf provided, then the result of the evaluated variable will be running through this map function Whether the processed variable sould be trimmed (removing whitespaces from both sides). Defaults to
true
View on GitHub
Install in Dash
TemplateVariable Class Reference