protocol
TextOutputStreamable
A source of text-streaming operations.
Conforming Types | Character, Double, Float, Float80, String, StringProtocol, Substring, Unicode.Scalar |
---|
Instance Methods
Writes a textual representation of this instance into the given output stream.
Declaration
func
write
<
Target
>
(
to
target
:
inout
Target
)
where
Target
:
TextOutputStream
Instances of types that conform to the
TextOutputStreamable
protocol can write their value to instances of any type that conforms to theTextOutputStream
protocol. The Swift standard library's text-related types,String
,Character
, andUnicode.Scalar
, all conform toTextOutputStreamable
.Conforming to the TextOutputStreamable Protocol
To add
TextOutputStreamable
conformance to a custom type, implement the requiredwrite(to:)
method. Call the given output stream'swrite(_:)
method in your implementation.