protocol CustomStringConvertible
Inheritance | View Protocol Hierarchy → |
---|---|
Import | import Swift |
Instance Variables
var description: String Required
A textual representation of self
.
Declaration
var description: String { get }
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 aninstance
of any type, returning itsdescription
if theinstance
happens to beCustomStringConvertible
. UsingCustomStringConvertible
as a generic constraint, or accessing a conforming type'sdescription
directly, is therefore discouraged.See Also:
String.init<T>(T)
,CustomDebugStringConvertible