<!--
{
  "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/Mirror",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s6MirrorV"
  },
  "title" : "Mirror"
}
-->

# Mirror

A representation of the substructure and display style of an instance of
any type.

```
struct Mirror
```

## Overview

A mirror describes the parts that make up a particular instance, such as
the instance’s stored properties, collection or tuple elements, or its
active enumeration case. Mirrors also provide a “display style” property
that suggests how this mirror might be rendered.

Playgrounds and the debugger use the `Mirror` type to display
representations of values of any type. For example, when you pass an
instance to the `dump(_:_:_:_:)` function, a mirror is used to render that
instance’s runtime contents.

```
struct Point {
    let x: Int, y: Int
}

let p = Point(x: 21, y: 30)
print(String(reflecting: p))
// Prints "▿ Point
//           - x: 21
//           - y: 30"
```

To customize the mirror representation of a custom type, add conformance to
the `CustomReflectable` protocol.

## Topics

### Querying Descendants

[`descendant(_:_:)`](/documentation/Swift/Mirror/descendant(_:_:))

Returns a specific descendant of the reflected subject, or `nil` if no
such descendant exists.

[`MirrorPath`](/documentation/Swift/MirrorPath)

A protocol for legitimate arguments to `Mirror`’s `descendant`
method.



---

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)
