Instance Method

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

An NSURL object that provides the URL to download.

Return Value

The new session download task.

Discussion

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