Merge branch 'refactor_downloader_config' into 5.x

This commit is contained in:
DreamPiggy 2018-04-05 18:45:30 +08:00
commit 00a0e01a32
2 changed files with 4 additions and 2 deletions

View File

@ -25,6 +25,7 @@ typedef NS_ENUM(NSInteger, SDWebImageDownloaderExecutionOrder) {
/**
Gets/Sets the default downloader config used for shared instance or initialization when it does not provide any downloader config. Such as `SDWebImageDownloader.sharedDownloader`.
@note You can modify the property on default downloader config, which can be used for later created downloader instance. The already created downloader instance does not get affected.
@note You should not pass nil to this value.
*/
@property (nonatomic, class, nonnull) SDWebImageDownloaderConfig *defaultDownloaderConfig;

View File

@ -13,9 +13,10 @@ static SDWebImageDownloaderConfig * _defaultDownloaderConfig;
@implementation SDWebImageDownloaderConfig
+ (SDWebImageDownloaderConfig *)defaultDownloaderConfig {
if (!_defaultDownloaderConfig) {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_defaultDownloaderConfig = [SDWebImageDownloaderConfig new];
}
});
return _defaultDownloaderConfig;
}