Documentation Language: Swift

Method

createWriter(url:mode:charset:indentation:)

Creates a new writer for the specified target.

@MainActor func createWriter(url: String, mode: MTLOpenMode, charset: String, indentation: MTLIndentation) async throws -> MTLWriter

Parameters

url

The target file path or identifier

mode

The file opening mode (overwrite, append, create)

charset

The character encoding (typically “UTF-8”)

indentation

The initial indentation for this writer

Return Value

A new MTLWriter instance for the target

Discussion

This method is called when a file block begins execution in an MTL template. The strategy should create and return a writer configured for the target URL.