Generic Function

dump(_:to:name:indent:maxDepth:maxItems:)

Dumps the given object’s contents using its mirror to the specified output stream.

Declaration

@discardableResult func dump<T, TargetStream>(_ value: T, to target: inout TargetStream, name: String? = default, indent: Int = default, maxDepth: Int = default, maxItems: Int = default) -> T where TargetStream : TextOutputStream

Parameters

value

The value to output to the target stream.

target

The stream to use for writing the contents of value.

name

A label to use when writing the contents of value. When nil is passed, the label is omitted. The default is nil.

indent

The number of spaces to use as an indent for each line of the output. The default is 0.

maxDepth

The maximum depth to descend when writing the contents of a value that has nested components. The default is Int.max.

maxItems

The maximum number of elements for which to write the full contents. The default is Int.max.

Return Value

The instance passed as value.

See Also

Printing and Dumping

func print(Any..., separator: String, terminator: String)

Writes the textual representations of the given items into the standard output.

func print<Target>(Any..., separator: String, terminator: String, to: inout Target)

Writes the textual representations of the given items into the given output stream.

func debugPrint(Any..., separator: String, terminator: String)

Writes the textual representations of the given items most suitable for debugging into the standard output.

func debugPrint<Target>(Any..., separator: String, terminator: String, to: inout Target)

Writes the textual representations of the given items most suitable for debugging into the given output stream.

func dump<T>(T, name: String?, indent: Int, maxDepth: Int, maxItems: Int) -> T

Dumps the given object’s contents using its mirror to standard output.