Documentation Language: Swift

Structure

MTLBlock

Represents a block of MTL statements.

struct MTLBlock

Overview

Blocks group statements together for execution as a unit, supporting both inlined blocks (no indentation) and standard blocks (with indentation). They form the body of templates, loops, conditionals, and other control structures.

Overview

MTL blocks serve multiple purposes:

Example Usage

// Simple text block
let textBlock = MTLBlock(statements: [
    MTLTextStatement(value: "public class "),
    MTLExpressionStatement(expression: nameExpr),
    MTLTextStatement(value: " {"),
    MTLNewLineStatement()
])

// Inlined block (no indentation changes)
let inlinedBlock = MTLBlock(
    statements: [
        MTLTextStatement(value: "inline content")
    ],
    inlined: true
)

Topics

Operators

?
==(_:_:)

Compares two MTL blocks for equality.

Initializers

?
init(statements:inlined:)

Creates a new MTL block.

Instance Properties

V
inlined

Whether this block is inlined (no indentation changes).

V
statements

The statements in this block.

Instance Methods

F
execute(in:)

Executes all statements in this block within the given context.

F
hash(into:)

Hashes the essential components of the block into the given hasher.

Default Implementations

Relationships

Conforms To