Instance Method

write(_:completionHandler:)

Write the data to the connection.

Declaration

func write(_ data: Data, completionHandler completion: @escaping (Error?) -> Void)

Parameters

data

The data object whose content will be written.

completionHandler

The completion handler to be invoked when the data content has been written or an error has occurred. If error is nil, the write succeeded and the caller can write more data.

Discussion

Callers should wait until the completionHandler is executed before issuing another write.

See Also

Transferring Data

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software