Kingfisher Documentation

Structure Download​Task

public struct DownloadTask  

Represents a task of an image downloading process.



public let sessionTask: SessionDataTask

The SessionDataTask object bounded to this download task. Multiple DownloadTasks could refer to a same sessionTask. This is an optimization in Kingfisher to prevent multiple downloading task for the same URL resource at the same time.

When you cancel a DownloadTask, this SessionDataTask and its cancel token will be pass through. You can use them to identify the cancelled task.


public let cancelToken: SessionDataTask.CancelToken

The cancel token which is used to cancel the task. This is only for identify the task when it is cancelled. To cancel a DownloadTask, use cancel instead.



public func cancel()  

Cancel this task if it is running. It will do nothing if this task is not running.

If you need to cancel all DownloadTasks of a url, use ImageDownloader.cancel(url:). If you need to cancel all downloading tasks of an ImageDownloader, use ImageDownloader.cancelAll().