TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Oct 2017 |
Maintained by Chuong Huynh.
HMCDownloadManager is a wrapper supporting downloading multiple files within a singleton object.
By download multiple files concurrently (same or not same URL), we can set maximumDownloadItem for number of maximum items can be downloaded concurrently. We can choose between background (items can be downloaded when app is in background) or default download manager. Callback each block for each item in different queues.
To run the example project, clone the repo, and run pod install
from the Example directory first.
HMCDownloadManager is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'HMCDownloadManager'
HMCDownloadManager *defaultDownload = [HMCDownloadManager sharedDefaultManager];
HMCDownloadManager *backgroundDownload = [HMCDownloadManager sharedBackgroundManager];
defaultDownload.timeoutForRequest = 5.0;
defaultDownload.timeoutForResource = 3600;
backgroundDownload.timeoutForResource = 3600;
defaultDownload.maximumDownloadItems = 10;
dispatch_queue_t downloadQueue = dispatch_queue_create("Image Downloader", DISPATCH_QUEUE_SERIAL);
[defaultDownload startDownloadFromURL:url
progressBlock:^(NSURL *sourceUrl, NSString *identifier, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite) {
// Update UI progress
} destination:^NSURL *(NSURL *sourceUrl, NSString *identifier) {
// return destination file
} finishBlock:^(NSURL *sourceUrl, NSString *identifier, NSURL *fileLocation, NSError *error) {
// Update when finished downloading
} queue:downloadQueue];
[downloadManager pauseDownload:url];
[downloadManager resumeDownload:url];
[downloadManager cancelDownload:url];
chuonghuynh, [email protected]
HMCDownloadManager is available under the MIT license. See the LICENSE file for more info.