Structure

Mirror

Representation of the sub-structure and optional “display style” of any arbitrary subject instance.

Overview

Describes the parts—such as stored properties, collection elements, tuple elements, or the active enumeration case—that make up a particular instance. May also supply a “display style” property that suggests how this structure might be rendered.

Mirrors are used by playgrounds and the debugger.

Nested Types

Mirror.AncestorRepresentation

Representation of ancestor classes.

Mirror.DisplayStyle

A suggestion of how a Mirror’s subject is to be interpreted.

Symbols

Type Aliases

Child

An element of the reflected instance’s structure. The optional label may be used when appropriate, e.g. to represent the name of a stored property or of an active enum case, and will be used for lookup when Strings are passed to the descendant method.

Children

The type used to represent sub-structure.

Initializers

init<Subject, C>(Subject, children: C, displayStyle: Mirror.DisplayStyle?, ancestorRepresentation: Mirror.AncestorRepresentation)

Represent subject with structure described by children, using an optional displayStyle.

init<Subject, C>(Subject, unlabeledChildren: C, displayStyle: Mirror.DisplayStyle?, ancestorRepresentation: Mirror.AncestorRepresentation)

Represent subject with child values given by unlabeledChildren, using an optional displayStyle. The result’s child labels will all be nil.

init(reflecting: Any)

Reflect upon the given subject.

Instance Properties

let children: Mirror.Children

A collection of Child elements describing the structure of the reflected subject.

var customMirror: Mirrorvar description: String
let displayStyle: Mirror.DisplayStyle?

Suggests a display style for the reflected subject.

let subjectType: Any.Type

The static type of the subject being reflected.

var superclassMirror: Mirror?

Instance Methods

func descendant(MirrorPath, MirrorPath...)

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

Relationships