DownloadQueue
class DownloadQueue : OperationQueue
OperationQueue class, which is responsible for managing all download operations.
-
Progress.
Declaration
Swift
var downloadProgress: DownloadTaskProgress
-
The
Operation
object that used to report the completion of all running operations.Declaration
Swift
var finishedOperation: Operation?
-
List of tasks that failed.
Declaration
Swift
let failedTasks: SynchronizedArray<DMSwiftTypealias.Download.FailedTask>
-
Informs successful start of operations.
Declaration
Swift
public var onStarted: (() -> Void)?
-
Informs on changes in progress.
Declaration
Swift
public var onTaskProgressUpdate: ((_ progress: DownloadTaskProgress) -> Void)?
-
Informs on when downloaded size or total files size changes.
Declaration
Swift
public var onDownloadProgressUpdate: ((_ progress: DownloadTaskProgress) -> Void)?
-
Informs when one of files will be saved.
Declaration
Swift
public var onFileSaveComplete: ((_ fileData: DMSwiftTypealias.Download.SavedFileData?) -> Void)?
-
Informs completion of all operations.
Declaration
Swift
public var onComplete: ((_ failledTasks: [DMSwiftTypealias.Download.FailedTask]) -> Void)?
-
Initiates with required parameters.
Declaration
Swift
init(configuration: DMSwiftConfiguration, fileStorage: FileStorage)
Parameters
configuration
Configuration to customize download process.
fileStorage
File storage manager for files manipulations.
-
Updates
Self
with a new configuration.Declaration
Swift
func update(with downloaderConfiguration: DMSwiftConfiguration)
Parameters
downloaderConfiguration
A new configuration.
-
Updates
FileStorage
.Declaration
Swift
func update(with fileStorage: FileStorage)
Parameters
fileStorage
a new
FileStorage
-
Method used to start all operations in the queue or add new operation to the queue.
Declaration
Swift
func start(_ requests: [URLRequestTestable], completion: ((_ fileData: DMSwiftTypealias.Download.FileData) -> Void)? = nil)
Parameters
requests
The list of requests that are needed to create a list of download operations.
completion
Completion handler that will be called where time when a download task will be finished.