Addressing comments

This commit is contained in:
Garrett Moon
2016-02-09 14:05:36 -08:00
parent 820390e496
commit 48fc4810cd
6 changed files with 200 additions and 148 deletions

View File

@@ -16,12 +16,6 @@ typedef void(^ASImageCacherCompletion)(UIImage * _Nullable imageFromCache);
@protocol ASImageCacheProtocol <NSObject>
@optional
/**
@deprecated This method is deprecated @see cachedImageWithURL:callbackQueue:completion: instead
*/
- (void)fetchCachedImageWithURL:(nullable NSURL *)URL
callbackQueue:(nullable dispatch_queue_t)callbackQueue
completion:(void (^)(CGImageRef _Nullable imageFromCache))completion;
/**
@abstract Attempts to fetch an image with the given URL from the cache.
@@ -33,10 +27,17 @@ typedef void(^ASImageCacherCompletion)(UIImage * _Nullable imageFromCache);
@discussion If `URL` is nil, `completion` will be invoked immediately with a nil image. This method should not block
the calling thread as it is likely to be called from the main thread.
*/
- (void)cachedImageWithURL:(nullable NSURL *)URL
callbackQueue:(nullable dispatch_queue_t)callbackQueue
- (void)cachedImageWithURL:(NSURL *)URL
callbackQueue:(dispatch_queue_t)callbackQueue
completion:(ASImageCacherCompletion)completion;
/**
@abstract Called during clearFetchedData. Allows the cache to optionally trim items.
@note Depending on your caches implementation you may *not* wish to respond to this method. It is however useful
if you have a memory and disk cache in which case you'll likely want to clear out the memory cache.
*/
- (void)clearFetchedImageFromCacheWithURL:(NSURL *)URL;
@end
typedef void(^ASImageDownloaderCompletion)(UIImage * _Nullable image, NSError * _Nullable error, id _Nullable downloadIdentifier);
@@ -44,8 +45,9 @@ typedef void(^ASImageDownloaderProgress)(CGFloat progress);
typedef void(^ASImageDownloaderProgressImage)(UIImage *progressImage, id _Nullable downloadIdentifier);
typedef NS_ENUM(NSUInteger, ASImageDownloaderPriority) {
ASImageDownloaderPriorityNormal = 0,
ASImageDownloaderPriorityDisplay,
ASImageDownloaderPriorityPreload = 0,
ASImageDownloaderPriorityImminent,
ASImageDownloaderPriorityVisible
};
@protocol ASImageDownloaderProtocol <NSObject>
@@ -62,15 +64,7 @@ typedef NS_ENUM(NSUInteger, ASImageDownloaderPriority) {
@optional
//You must implement one of the two following methods
/**
@deprecated This method is deprecated @see downloadImageWithURL:callbackQueue:downloadProgress:completion: instead
*/
- (nullable id)downloadImageWithURL:(NSURL *)URL
callbackQueue:(nullable dispatch_queue_t)callbackQueue
downloadProgressBlock:(void (^ _Nullable)(CGFloat progress))downloadProgressBlock
completion:(void (^ _Nullable)(CGImageRef _Nullable image, NSError * _Nullable error))completion;
//You must implement the following method OR the deprecated method at the bottom
/**
@abstract Downloads an image with the given URL.
@@ -113,4 +107,29 @@ withDownloadIdentifier:(id)downloadIdentifier;
@end
@protocol ASImageDownloaderProtocolDeprecated <ASImageDownloaderProtocol>
@optional
/**
@deprecated This method is deprecated @see downloadImageWithURL:callbackQueue:downloadProgress:completion: instead
*/
- (nullable id)downloadImageWithURL:(NSURL *)URL
callbackQueue:(nullable dispatch_queue_t)callbackQueue
downloadProgressBlock:(void (^ _Nullable)(CGFloat progress))downloadProgressBlock
completion:(void (^ _Nullable)(CGImageRef _Nullable image, NSError * _Nullable error))completion;
@end
@protocol ASImageCacheProtocolDeprecated <ASImageCacheProtocol>
@optional
/**
@deprecated This method is deprecated @see cachedImageWithURL:callbackQueue:completion: instead
*/
- (void)fetchCachedImageWithURL:(nullable NSURL *)URL
callbackQueue:(nullable dispatch_queue_t)callbackQueue
completion:(void (^)(CGImageRef _Nullable imageFromCache))completion;
@end
NS_ASSUME_NONNULL_END