init(_:addNewlines:)

Initialize a new printer using the existing state from another printer but with support to control the behavior of addNewlines.

CodePrinter.swift:100
init(_ parent: CodePrinter, addNewlines newlines: Bool)

Parameters

parent

The other printer to copy the configuration/state from.

newlines

A boolean indicating if every print and printIndented should automatically add newlines to the end of the strings.

This can be useful to use with generation subtasks, so see if they actually generate something (via isEmpty) to then optionally add it back into the parent with whatever surounding content.

This is most useful to then use append to add the new content.