<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/dump(_:to:name:indent:maxDepth:maxItems:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s4dump_2to4name6indent8maxDepth0E5Itemsxx_q_zSSSgS3its16TextOutputStreamR_r0_lF"
  },
  "title" : "dump(_:to:name:indent:maxDepth:maxItems:)"
}
-->

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

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

```
@discardableResult func dump<T, TargetStream>(_ value: T, to target: inout TargetStream, name: String? = nil, indent: Int = 0, maxDepth: Int = .max, maxItems: Int = .max) -> 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`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)