If a download via the download method in Client succeeds the completion handler is called twice:
The first call is triggered by downloadExecutor(_ downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL). The second by downloadExecutor(_ downloadTask: URLSessionDownloadTask, didCompleteWithError error: Error?) with error = nil.
Since download(url: URL, progressHandler: DownloadHandler.ProgressHandler, _ completion: @escaping DownloadHandler.CompletionHandler) offers a completion handler (and not some delegation), completion should only called once after the internal downloadTask has finished.
If a download via the
download
method inClient
succeeds the completion handler is called twice:The first call is triggered by
downloadExecutor(_ downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL)
. The second bydownloadExecutor(_ downloadTask: URLSessionDownloadTask, didCompleteWithError error: Error?)
witherror = nil
.Since
download(url: URL, progressHandler: DownloadHandler.ProgressHandler, _ completion: @escaping DownloadHandler.CompletionHandler)
offers a completion handler (and not some delegation),completion
should only called once after the internaldownloadTask
has finished.