A representation of the substructure and display style of an instance of any type.
- Xcode 7.0+
- Swift Standard Library
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.
To customize the mirror representation of a custom type, add conformance to the