Documentation Language: Swift

Class

MTLFileSystemStrategy

File system-based generation strategy that writes to disk.

actor MTLFileSystemStrategy

Overview

This strategy writes generated text directly to the file system, creating directories as needed and handling file modes (overwrite, append, create).

Overview

Features:

File Modes

Example Usage

let strategy = MTLFileSystemStrategy(basePath: "/output")

let writer = try await strategy.createWriter(
    url: "models/Person.swift",
    mode: .overwrite,
    charset: "UTF-8",
    indentation: MTLIndentation()
)

await writer.writeLine("// Generated file")
await writer.writeLine("class Person {}")

try await strategy.finalizeWriter(writer)
// File written to /output/models/Person.swift

Topics

Initializers

?
init(basePath:)

Creates a new file system strategy with the specified base path.

Instance Methods

F
createWriter(url:mode:charset:indentation:)

Creates a new writer for the specified target.

F
finalizeWriter(_:)

Finalizes and commits the writer’s content to its target.

Default Implementations

Relationships

Conforms To