Documentation Language: Swift

Method

openFile(url:mode:charset:)

Opens a new file for output, pushing a new writer onto the stack.

@MainActor func openFile(url: String, mode: MTLOpenMode, charset: String) async throws

Parameters

url

The file path or URL

mode

The file opening mode (overwrite, append, create)

charset

The character encoding (typically “UTF-8”)

Discussion

All subsequent text output will go to this file until closeFile() is called. File blocks can be nested.