---
title: Mirror
framework: swift
role: symbol
role_heading: Structure
path: swift/mirror
---

# Mirror

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

## Declaration

```swift
struct Mirror
```

## Overview

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(_:_:)](swift/mirror/descendant(_:_:).md)
- [MirrorPath](swift/mirrorpath.md)

### Initializers

- [init(_:children:displayStyle:ancestorRepresentation:)](swift/mirror/init(_:children:displaystyle:ancestorrepresentation:)-34d91.md)
- [init(_:children:displayStyle:ancestorRepresentation:)](swift/mirror/init(_:children:displaystyle:ancestorrepresentation:)-4af97.md)
- [init(_:unlabeledChildren:displayStyle:ancestorRepresentation:)](swift/mirror/init(_:unlabeledchildren:displaystyle:ancestorrepresentation:).md)
- [init(reflecting:)](swift/mirror/init(reflecting:).md)
- [init(reflectingForTest:)](swift/mirror/init(reflectingfortest:)-5t8yc.md)
- [init(reflectingForTest:)](swift/mirror/init(reflectingfortest:)-6nh7d.md)

### Instance Properties

- [children](swift/mirror/children-swift.property.md)
- [displayStyle](swift/mirror/displaystyle-swift.property.md)
- [subjectType](swift/mirror/subjecttype.md)
- [superclassMirror](swift/mirror/superclassmirror.md)

### Type Aliases

- [Mirror.Child](swift/mirror/child.md)
- [Mirror.Children](swift/mirror/children-swift.typealias.md)

### Enumerations

- [Mirror.AncestorRepresentation](swift/mirror/ancestorrepresentation.md)
- [Mirror.DisplayStyle](swift/mirror/displaystyle-swift.enum.md)

### Default Implementations

- [CustomReflectable Implementations](swift/mirror/customreflectable-implementations.md)
- [CustomStringConvertible Implementations](swift/mirror/customstringconvertible-implementations.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [CustomReflectable](swift/customreflectable.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Escapable](swift/escapable.md)

## See Also

### Querying Runtime Values

- [ObjectIdentifier](swift/objectidentifier.md)
- [type(of:)](swift/type(of:).md)
