enum Mirror.AncestorRepresentation

Representation of ancestor classes.

A CustomReflectable class can control how its mirror will represent ancestor classes by initializing the mirror with a AncestorRepresentation. This setting has no effect on mirrors reflecting value type instances.

Import import Swift


case generated

Generate a default mirror for all ancestor classes.

This case is the default.

Note: This option generates default mirrors even for ancestor classes that may implement CustomReflectable's customMirror requirement. To avoid dropping an ancestor class customization, an override of customMirror should pass ancestorRepresentation: .Customized(super.customMirror) when initializing its Mirror.


case customized(() -> Mirror)

Use the nearest ancestor's implementation of customMirror to create a mirror for that ancestor. Other classes derived from such an ancestor are given a default mirror.

The payload for this option should always be "{ super.customMirror }":

var customMirror: Mirror {
  return Mirror(
    children: ["someProperty": self.someProperty],
    ancestorRepresentation: .Customized({ super.customMirror })) // <==


case suppressed

Suppress the representation of all ancestor classes. The resulting Mirror's superclassMirror is nil.