Documentation Language: Swift

Method

newLine(indent:)

Writes a newline character to the buffer.

func newLine(indent: Bool = true)

Parameters

indent

Whether the next line should be indented (default: true)

  • If true, the next write will apply indentation

  • If false, the next write will not apply indentation

Discussion

This marks the writer as being at the start of a new line, so the next write operation will apply indentation.

Example

await writer.write("Line 1")
await writer.newLine()
await writer.write("Line 2")  // Will be indented

await writer.write("Line 3")
await writer.newLine(indent: false)
await writer.write("Line 4")  // Will NOT be indented