jamztang
11/11/2011 - 7:12 PM

UIImage downloader spec using proxy placeholder. Anyone in favor of this idea?

UIImage downloader spec using proxy placeholder. Anyone in favor of this idea?

@class JTImageProxy;

@interface UIImage (JTImageProxy)

+ (UIImage <JTImageProxy> *)imageWithURL:(NSURL *)URL;

@end
@class JTImageProxy;

@interface UIImage (JTImageProxy)

+ (UIImage <JTImageProxy> *)imageWithURL:(NSURL *)URL;

@end
#import <UIKit/UIKit.h>

@protocol JTImageProxy <NSObject>

- (NSURL *)URL;
- (CGFloat)expectedSize;
- (CGFloat)totalDownloadedSize;
- (CGFloat)progress;
- (NSError *)error;
- (void)cancelDownload;
- (void)restartDownload;

@end

@interface JTImageProxy : NSProxy <JTImageProxy>

@property (nonatomic, strong) NSURL *URL;
@property (nonatomic, strong) UIImage *image;

+ (JTImageProxy *)proxyWithURL:(NSURL *)URL;

@end