Instance Method

dataTaskPublisher(for:)

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

Declaration

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

Parameters

url

The URL 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: URLRequest) -> URLSession.DataTaskPublisher

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

struct URLSession.DataTaskPublisher

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