Skip to content

Instantly share code, notes, and snippets.

@jamztang
Created November 11, 2011 19:12
Show Gist options
  • Save jamztang/1358918 to your computer and use it in GitHub Desktop.
Save jamztang/1358918 to your computer and use it in GitHub Desktop.
UIImage downloader spec using proxy placeholder. Anyone in favor of this idea?
#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
@class JTImageProxy;
@interface UIImage (JTImageProxy)
+ (UIImage <JTImageProxy> *)imageWithURL:(NSURL *)URL;
@end
@class JTImageProxy;
@interface UIImage (JTImageProxy)
+ (UIImage <JTImageProxy> *)imageWithURL:(NSURL *)URL;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment