DownloadTask
class DownloadTask : NSObject, DownloadableTask
Undocumented
-
Undocumented
Declaration
Swift
weak var delegate: DownloadDelegate? -
Declaration
Swift
var onReciveFileSize: ((Int64) -> Void)? -
Declaration
Swift
var onUpdateProgress: ((DMSwiftTypealias.Download.ProgressData) -> Void)? -
Declaration
Swift
var completionHandler: ((DMSwiftTypealias.Download.FileData) -> Void)? -
The file data saved.
Declaration
Swift
var onFileDataChange: ((DMSwiftTypealias.Download.SavedFileData) -> Void)? -
Declaration
Swift
var fileStorage: FileStorage? -
Declaration
Swift
var fileData: DMSwiftTypealias.Download.SavedFileData? -
Undocumented
Declaration
Swift
var session: URLSessionTestable? -
Declaration
Swift
var totalBytesWritten: Int64 -
Download type.
Declaration
Swift
var downloadType: URLSessionTaskType -
File size.
Declaration
Swift
var fileSize: Int64 { get set } -
Initiates with required parameters.
Declaration
Swift
init(_ request: URLRequestTestable, fileStorage: FileStorage, delegate: DownloadDelegate? = nil, downloadType: URLSessionTaskType, timeoutIntervalForRequest: TimeInterval, _ completionHandler: ((DMSwiftTypealias.Download.FileData) -> Void)? = nil)Parameters
requestRemote request to the file.
fileStorageFile storage manager.
delegateProgress delegate.
downloadTypeDownload type.
timeoutIntervalForRequestRequest timeout interval.
completionHandlerComplete handler.
-
Starts download task.
Declaration
Swift
func start() -
Cancel download task.
Declaration
Swift
func cancel()
-
Undocumented
Declaration
Swift
func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) -
Undocumented
Declaration
Swift
func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64)
-
Undocumented
Declaration
Swift
func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) -
Undocumented
Declaration
Swift
func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data)
-
Undocumented
Declaration
Swift
func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?)
DownloadTask Class Reference