diff --git a/SDWebImage/SDWebImageDownloader.h b/SDWebImage/SDWebImageDownloader.h index b75b69a2..db57e9da 100644 --- a/SDWebImage/SDWebImageDownloader.h +++ b/SDWebImage/SDWebImageDownloader.h @@ -62,6 +62,12 @@ typedef void(^SDWebImageDownloaderCompletedBlock)(UIImage *image, NSData *data, @property (assign, nonatomic) NSInteger maxConcurrentDownloads; +/** + * Shows the current amount of downloads that still need to be downloaded + */ + +@property (readonly, nonatomic) NSUInteger currentDownloadCount; + /** * Changes download operations execution order. Default value is `SDWebImageDownloaderFIFOExecutionOrder`. */ diff --git a/SDWebImage/SDWebImageDownloader.m b/SDWebImage/SDWebImageDownloader.m index fb3bd13a..dcc303ef 100644 --- a/SDWebImage/SDWebImageDownloader.m +++ b/SDWebImage/SDWebImageDownloader.m @@ -104,6 +104,11 @@ static NSString *const kCompletedCallbackKey = @"completed"; _downloadQueue.maxConcurrentOperationCount = maxConcurrentDownloads; } +- (NSUInteger)currentDownloadCount +{ + return _downloadQueue.operationCount; +} + - (NSInteger)maxConcurrentDownloads { return _downloadQueue.maxConcurrentOperationCount;