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 @@ -63,7 +63,7 @@ typedef void(^SDWebImageCalculateSizeBlock)(NSUInteger fileCount, NSUInteger tot
63 * 63 *
64 * @return SDImageCache global instance 64 * @return SDImageCache global instance
65 */ 65 */
66 -+ (nonnull SDImageCache *)sharedImageCache; 66 ++ (nonnull instancetype)sharedImageCache;
67 67
68 /** 68 /**
69 * Init a new cache store with a specific namespace 69 * Init a new cache store with a specific namespace
@@ -65,7 +65,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) { @@ -65,7 +65,7 @@ FOUNDATION_STATIC_INLINE NSUInteger SDCacheCostForImage(UIImage *image) {
65 65
66 #pragma mark - Singleton, init, dealloc 66 #pragma mark - Singleton, init, dealloc
67 67
68 -+ (nonnull SDImageCache *)sharedImageCache { 68 ++ (nonnull instancetype)sharedImageCache {
69 static dispatch_once_t once; 69 static dispatch_once_t once;
70 static id instance; 70 static id instance;
71 dispatch_once(&once, ^{ 71 dispatch_once(&once, ^{
@@ -124,7 +124,7 @@ typedef SDHTTPHeadersDictionary * _Nullable (^SDWebImageDownloaderHeadersFilterB @@ -124,7 +124,7 @@ typedef SDHTTPHeadersDictionary * _Nullable (^SDWebImageDownloaderHeadersFilterB
124 * 124 *
125 * @return global shared instance of downloader class 125 * @return global shared instance of downloader class
126 */ 126 */
127 -+ (nonnull SDWebImageDownloader *)sharedDownloader; 127 ++ (nonnull instancetype)sharedDownloader;
128 128
129 /** 129 /**
130 * Set the default URL credential to be set for request operations. 130 * Set the default URL credential to be set for request operations.
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 } 54 }
55 } 55 }
56 56
57 -+ (nonnull SDWebImageDownloader *)sharedDownloader { 57 ++ (nonnull instancetype)sharedDownloader {
58 static dispatch_once_t once; 58 static dispatch_once_t once;
59 static id instance; 59 static id instance;
60 dispatch_once(&once, ^{ 60 dispatch_once(&once, ^{
@@ -179,7 +179,7 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager]; @@ -179,7 +179,7 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
179 * 179 *
180 * @return SDWebImageManager shared instance 180 * @return SDWebImageManager shared instance
181 */ 181 */
182 -+ (nonnull SDWebImageManager *)sharedManager; 182 ++ (nonnull instancetype)sharedManager;
183 183
184 /** 184 /**
185 * Allows to specify instance of cache and image downloader used with image manager. 185 * Allows to specify instance of cache and image downloader used with image manager.
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 29
30 @implementation SDWebImageManager 30 @implementation SDWebImageManager
31 31
32 -+ (nonnull SDWebImageManager*)sharedManager { 32 ++ (nonnull instancetype)sharedManager {
33 static dispatch_once_t once; 33 static dispatch_once_t once;
34 static id instance; 34 static id instance;
35 dispatch_once(&once, ^{ 35 dispatch_once(&once, ^{
@@ -68,7 +68,7 @@ typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls, @@ -68,7 +68,7 @@ typedef void(^SDWebImagePrefetcherCompletionBlock)(NSUInteger noOfFinishedUrls,
68 /** 68 /**
69 * Return the global image prefetcher instance. 69 * Return the global image prefetcher instance.
70 */ 70 */
71 -+ (nonnull SDWebImagePrefetcher *)sharedImagePrefetcher; 71 ++ (nonnull instancetype)sharedImagePrefetcher;
72 72
73 /** 73 /**
74 * Allows you to instantiate a prefetcher with any arbitrary image manager. 74 * Allows you to instantiate a prefetcher with any arbitrary image manager.
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 23
24 @implementation SDWebImagePrefetcher 24 @implementation SDWebImagePrefetcher
25 25
26 -+ (nonnull SDWebImagePrefetcher *)sharedImagePrefetcher { 26 ++ (nonnull instancetype)sharedImagePrefetcher {
27 static dispatch_once_t once; 27 static dispatch_once_t once;
28 static id instance; 28 static id instance;
29 dispatch_once(&once, ^{ 29 dispatch_once(&once, ^{