Contents

downloadTask(with:)

Creates a download task that retrieves the contents of the specified URL and saves the results to a file.

Declaration

func downloadTask(with url: URL) -> URLSessionDownloadTask

Parameters

  • url:

    The URL to download.

Mentioned in

Return Value

The new session download task.

Discussion

After you create the task, you must start it by calling its resume() method.

See Also

Adding download tasks to a session