KTVHCDataLoader.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //
  2. // KTVHCDataLoader.h
  3. // KTVHTTPCache
  4. //
  5. // Created by Single on 2018/6/7.
  6. // Copyright © 2018 Single. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @class KTVHCDataLoader;
  10. @class KTVHCDataRequest;
  11. @class KTVHCDataResponse;
  12. @protocol KTVHCDataLoaderDelegate <NSObject>
  13. - (void)loaderDidFinished:(KTVHCDataLoader *)loader;
  14. - (void)loader:(KTVHCDataLoader *)loader didFailed:(NSError *)error;
  15. - (void)loader:(KTVHCDataLoader *)loader didChangeProgress:(double)progress;
  16. @end
  17. @interface KTVHCDataLoader : NSObject
  18. + (instancetype)new NS_UNAVAILABLE;
  19. - (instancetype)init NS_UNAVAILABLE;
  20. + (instancetype)loaderWithRequest:(KTVHCDataRequest *)request;
  21. @property (nonatomic, weak) id <KTVHCDataLoaderDelegate> delegate;
  22. @property (nonatomic, strong) id object;
  23. @property (nonatomic, strong, readonly) KTVHCDataRequest * request;
  24. @property (nonatomic, strong, readonly) KTVHCDataResponse * response;
  25. @property (nonatomic, strong, readonly) NSError * error;
  26. @property (nonatomic, assign, readonly) BOOL didClosed;
  27. @property (nonatomic, assign, readonly) BOOL didFinished;
  28. @property (nonatomic, assign, readonly) double progress;
  29. - (void)prepare;
  30. - (void)close;
  31. @end