Authored by Bogdan Poplauschi

The shared objects (not really singletons) should allow subclassing, therefore t…

…he return type should be instancetype and not a fixed type.
... ... @@ -63,7 +63,7 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
*
* @return SDImageCache global instance
*/
+ (nonnull SDImageCache *)sharedImageCache;
+ (nonnull instancetype)sharedImageCache;
/**
* Init a new cache store with a specific namespace
... ...
... ... @@ -65,7 +65,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
#pragma mark - Singleton, init, dealloc
+ (nonnull SDImageCache *)sharedImageCache {
+ (nonnull instancetype)sharedImageCache {
static dispatch_once_t once;
static id instance;
dispatch_once(&once, ^{
... ...
... ... @@ -124,7 +124,7 @@ typedef SDHTTPHeadersDictionary * _Nullable (^SDWebImageDownloaderHeadersFilterB
*
* @return global shared instance of downloader class
*/
+ (nonnull SDWebImageDownloader *)sharedDownloader;
+ (nonnull instancetype)sharedDownloader;
/**
* Set the default URL credential to be set for request operations.
... ...
... ... @@ -54,7 +54,7 @@
}
}
+ (nonnull SDWebImageDownloader *)sharedDownloader {
+ (nonnull instancetype)sharedDownloader {
static dispatch_once_t once;
static id instance;
dispatch_once(&once, ^{
... ...
... ... @@ -179,7 +179,7 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
*
* @return SDWebImageManager shared instance
*/
+ (nonnull SDWebImageManager *)sharedManager;
+ (nonnull instancetype)sharedManager;
/**
* Allows to specify instance of cache and image downloader used with image manager.
... ...
... ... @@ -29,7 +29,7 @@
@implementation SDWebImageManager
+ (nonnull SDWebImageManager*)sharedManager {
+ (nonnull instancetype)sharedManager {
static dispatch_once_t once;
static id instance;
dispatch_once(&once, ^{
... ...
... ... @@ -68,7 +68,7 @@ typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls,
/**
* Return the global image prefetcher instance.
*/
+ (nonnull SDWebImagePrefetcher *)sharedImagePrefetcher;
+ (nonnull instancetype)sharedImagePrefetcher;
/**
* Allows you to instantiate a prefetcher with any arbitrary image manager.
... ...
... ... @@ -23,7 +23,7 @@
@implementation SDWebImagePrefetcher
+ (nonnull SDWebImagePrefetcher *)sharedImagePrefetcher {
+ (nonnull instancetype)sharedImagePrefetcher {
static dispatch_once_t once;
static id instance;
dispatch_once(&once, ^{
... ...