Creates a string with a detailed representation of the given value, suitable for debugging.
SDK
- Xcode 7.0+
Framework
- Swift Standard Library
Declaration
Discussion
Use this initializer to convert an instance of any type to its custom debugging representation. The initializer creates the string representation of instance
in one of the following ways, depending on its protocol conformance:
If
subject
conforms to theCustom
protocol, the result isDebug String Convertible subject
..debug Description If
subject
conforms to theCustom
protocol, the result isString Convertible subject
..description If
subject
conforms to theText
protocol, the result is obtained by callingOutput Streamable subject
on an empty string.write(to: s) s
.An unspecified result is supplied automatically by the Swift standard library.
For example, this custom Point
struct uses the default representation supplied by the standard library.
After adding Custom
conformance by implementing the debug
property, Point
provides its own custom debugging representation.