CustomDump Documentation

Protocol Custom​Dump​Representable

public protocol CustomDumpRepresentable  

A type that can be converted to a value for the purpose of dumping.

The CustomDumpRepresentable protocol allows you to return any value for the purpose of dumping. This can be used to flatten the dump representation of wrapper types. For example, a type-safe identifier may want to dump its raw value directly:

struct ID: RawRepresentable {
  var rawValue: String
}

extension ID: CustomDumpRepresentable {
  var customDumpValue: Any {
    self.rawValue
  }
}

customDump(ID(rawValue: "deadbeef")
"deadbeef"

Requirements

custom​Dump​Value

var customDumpValue: Any  

The custom dump value for this instance.