WritableStream

public protocol WritableStream: class, TextOutputStream

An output stream, like standard output or a writeable file.

  • Undocumented

    Declaration

    Swift

    public protocol WritableStream: class, TextOutputStream
  • Writes x to the stream.

    Declaration

    Swift

    func write(_ x: String)
  • Closes the stream. Must be called on non-file streams when finished writing, to prevent deadlock when reading.

    Declaration

    Swift

    func close()
  • Writes the textual representations of the given items into the stream. Works exactly the same way as the built-in print.

    To avoid printing a newline at the end, pass terminator: "" or use write ìnstead.

    • Parameters:
      • items: Zero or more items to print, converting them to text with String(describing:).
      • separator: What to print between each item. Default is “ ”.
      • terminator: What to print at the end. Default is newline.

    Declaration

    Swift

    public func print(_ items: Any..., separator: String = " ", terminator: String = "\n")

    Parameters

    items

    Zero or more items to print, converting them to text with String(describing:).

    separator

    What to print between each item. Default is “ “.

    terminator

    What to print at the end. Default is newline.