CustomStringConvertible

protocol CustomStringConvertible

A type with a customized textual representation.

This textual representation is used when values are written to an output stream, for example, by print.

Note: String(instance) will work for an instance of any type, returning its description if the instance happens to be CustomStringConvertible. Using CustomStringConvertible as a generic constraint, or accessing a conforming type's description directly, is therefore discouraged.

See Also: String.init<T>(T), CustomDebugStringConvertible

Inheritance View Protocol Hierarchy →
Import import Swift

Instance Variables

var description: String Required

A textual representation of self.

Declaration

var description: String { get }