1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
@protocol DownloaderDelegate;

#import <Foundation/Foundation.h>

@interface Downloader : NSObject {

    id <DownloaderDelegate> delegate;

    NSString* strFileNameWithPath;

    NSURLConnection* connection;

    CGFloat floatTotalData;
    CGFloat floatReceivedData;
}

@property(nonatomic, retain) NSString* strFileNameWithPath;
@property(nonatomic, retain) id <DownloaderDelegate> delegate;

-(void)loadData;
-(float)getProgressInPercent;

@end

@protocol DownloaderDelegate <NSObject>

@optional
-(void)didReceiveData:(Downloader *)d; //will be called each time data has been received
-(void)didLoadData:(Downloader *)d; //will be called when the download has finished
@end