init(indent:)
CodePrinter.swift:51init(indent: String.UnicodeScalarView = " ".unicodeScalars)
Other members in extension
Type members
init(CodePrinter
) Initialize a new printer using the existing state from another printer.
init(CodePrinter, addNewlines: Bool
) Initialize a new printer using the existing state from another printer but with support to control the behavior of
addNewlines
.init(indent: String.UnicodeScalarView, addNewlines: Bool
) Initialize the printer for use.
Instance members
var content: String
The string content that was printed.
var isEmpty: Bool
See if anything was printed.
func append(CodePrinter, indenting: Bool
) Appended the content of another
CodePrinter
to this one.func indent(
) Increases the printer’s indentation level.
func outdent(
) Decreases the printer’s indentation level.
func print(String...
) Writes the given strings to the printer, adding a newline after each string.
func print(String..., newlines: Bool
) Writes the given strings to the printer, optionally adding a newline after each string. If called with no strings, a blank line is added to the printer.
func printIndented(String...
) Indents, writes the given strings to the printer, and then outdents.
func withIndentation(body: (_ p: inout CodePrinter) -> Void
) Indents, calls
body
to do other work relaying along the printer, and the outdents after wards.