Merge pull request #2633 from iliaskarim/IK/SDWebImageDownloader/ConvenienceMethod

Define SDWebImageDownloader convenience method
This commit is contained in:
DreamPiggy 2019-03-21 11:06:04 +08:00 committed by GitHub
commit 9e36d2c54c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View File

@ -207,6 +207,26 @@ typedef SDHTTPHeadersDictionary * _Nullable (^SDWebImageDownloaderHeadersFilterB
*/
- (void)setOperationClass:(nullable Class)operationClass;
/**
* Creates a SDWebImageDownloader async downloader instance with a given URL
*
* The delegate will be informed when the image is finish downloaded or an error has happen.
*
* @see SDWebImageDownloaderDelegate
*
* @param url The URL to the image to download
* @param completedBlock A block called once the download is completed.
* If the download succeeded, the image parameter is set, in case of error,
* error parameter is set with the error. The last parameter is always YES
* if SDWebImageDownloaderProgressiveDownload isn't use. With the
* SDWebImageDownloaderProgressiveDownload option, this block is called
* repeatedly with the partial image object and the finished argument set to NO
* before to be called a last time with the full image and finished argument
* set to YES. In case of error, the finished argument is always YES.
*/
- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url
completed:(nullable SDWebImageDownloaderCompletedBlock)completedBlock;
/**
* Creates a SDWebImageDownloader async downloader instance with a given URL
*

View File

@ -275,6 +275,11 @@
UNLOCK(self.operationsLock);
}
- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(NSURL *)url
completed:(SDWebImageDownloaderCompletedBlock)completedBlock {
return [self downloadImageWithURL:url options:0 progress:nil completed:completedBlock];
}
- (nullable SDWebImageDownloadToken *)downloadImageWithURL:(nullable NSURL *)url
options:(SDWebImageDownloaderOptions)options
progress:(nullable SDWebImageDownloaderProgressBlock)progressBlock