JubeatPlus 3.9.11
Loading...
Searching...
No Matches
ImageDownloader.h
Go to the documentation of this file.
1
8
9#import <UIKit/UIKit.h>
10
11NS_ASSUME_NONNULL_BEGIN
12
13@class ImageDownloader;
14
21@protocol ImageDownloaderDelegate <NSObject>
27- (void)imageDownloader:(nonnull ImageDownloader *)downloader didLoad:(nullable id)key;
28@end
29
33@interface ImageDownloader : NSObject <NSURLSessionDataDelegate>
34
36@property(nonatomic, readonly, nullable) NSURL *imageURL;
38@property(nonatomic, readonly, nullable) id key;
40@property(nonatomic, weak, nullable) id<ImageDownloaderDelegate> delegate;
42@property(nonatomic, readonly) BOOL downloading;
43
51- (instancetype)initWithImageURL:(nullable NSURL *)imageURL forKey:(nullable id)key;
52
57- (void)startDownload;
58
63- (void)cancelDownload;
64
70- (nullable UIImage *)getImage;
71
72@end
73
74NS_ASSUME_NONNULL_END
75
76// code: language=Objective-C
77// kate: hl Objective-C;
78// vim: set ft=objc :
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