11NS_ASSUME_NONNULL_BEGIN
21@protocol ImageDownloaderDelegate <NSObject>
27- (void)imageDownloader:(nonnull
ImageDownloader *)downloader didLoad:(nullable
id)key;
36@property(nonatomic, readonly, nullable) NSURL *
imageURL;
38@property(nonatomic, readonly, nullable)
id key;
40@property(nonatomic, weak, nullable) id<ImageDownloaderDelegate>
delegate;
51- (instancetype)initWithImageURL:(nullable NSURL *)imageURL forKey:(nullable
id)key;
Downloads one image over an NSURLSession and reports it to a delegate.
Definition ImageDownloader.h:33
NSURL * imageURL
The image's URL.
Definition ImageDownloader.h:36
BOOL downloading
Whether a download is in progress.
Definition ImageDownloader.h:42
void cancelDownload()
Cancels the download.
Definition ImageDownloader.m:66
id key
The cache key the download is associated with.
Definition ImageDownloader.h:38
void startDownload()
Starts the download.
Definition ImageDownloader.m:49
id< ImageDownloaderDelegate > delegate
The delegate told when the image loads.
Definition ImageDownloader.h:40
nullable UIImage * getImage()
The loaded image, or nil.
Definition ImageDownloader.m:74