WritableStream

public protocol WritableStream : AnyObject, TextOutputStream

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

  • Undocumented

    Declaration

    Swift

    var encoding: String.Encoding { get set }
  • Undocumented

    Declaration

    Swift

    var filehandle: FileHandle { get }
  • write(_:) Default implementation

    Writes x to the stream.

    Default Implementation

    Undocumented

    Declaration

    Swift

    func write(_ x: String)
  • close() Default implementation

    Closes the stream. Must be called on non-file streams when finished writing, to prevent deadlock when reading.

    Default Implementation

    Declaration

    Swift

    func close()
  • Writes the textual representations of the given items into the stream. Works exactly the same way as print from Swift’s standard library.

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

    Declaration

    Swift

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

    Parameters

    items

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

    separator

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

    terminator

    What to print at the end. Default is newline.

  • write(data:) Extension method

    Writes data to the stream.

    Declaration

    Swift

    public func write(data: Data)