Documentation Language: Swift

Method

getContent()

Returns the accumulated buffer contents.

func getContent() -> String

Return Value

The complete accumulated text including all indentation and newlines

Discussion

This retrieves all text that has been written to the buffer without clearing it. The buffer contents remain available for future writes.

Example

await writer.writeLine("Line 1")
await writer.writeLine("Line 2")

let content = await writer.getContent()
print(content)  // "Line 1\nLine 2\n"

// Buffer is still available
await writer.writeLine("Line 3")
let updated = await writer.getContent()
print(updated)  // "Line 1\nLine 2\nLine 3\n"