Instance Method

dataTaskPublisher(for:)

Returns a publisher that wraps a URL session data task for a given URL request.

Declaration

func dataTaskPublisher(for request: URLRequest) -> URLSession.DataTaskPublisher

Parameters

request

The URL request for which to create a data task.

Discussion

The publisher publishes data when the task completes, or terminates if the task fails with an error.

See Also

Performing Tasks as a Combine Publisher

func dataTaskPublisher(for: URL) -> URLSession.DataTaskPublisher

Returns a publisher that wraps a URL session data task for a given URL.

struct URLSession.DataTaskPublisher

A publisher that delivers the results of performing URL session data tasks.