PINRemoteImageManagerResult.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // PINRemoteImageManagerResult.h
  3. // Pods
  4. //
  5. // Created by Garrett Moon on 3/9/15.
  6. //
  7. //
  8. #import <Foundation/Foundation.h>
  9. #if PIN_TARGET_IOS
  10. #import <UIKit/UIKit.h>
  11. #elif PIN_TARGET_MAC
  12. #import <Cocoa/Cocoa.h>
  13. #endif
  14. #import "PINRemoteImageMacros.h"
  15. #if USE_FLANIMATED_IMAGE
  16. #import <FLAnimatedImage/FLAnimatedImage.h>
  17. #endif
  18. /** How the image was fetched. */
  19. typedef NS_ENUM(NSUInteger, PINRemoteImageResultType) {
  20. /** Returned if no image is returned */
  21. PINRemoteImageResultTypeNone = 0,
  22. /** Image was fetched from the memory cache */
  23. PINRemoteImageResultTypeMemoryCache,
  24. /** Image was fetched from the disk cache */
  25. PINRemoteImageResultTypeCache,
  26. /** Image was downloaded */
  27. PINRemoteImageResultTypeDownload,
  28. /** Image is progress */
  29. PINRemoteImageResultTypeProgress,
  30. };
  31. @interface PINRemoteImageManagerResult : NSObject
  32. @property (nonatomic, readonly, strong, nullable) PINImage *image;
  33. @property (nonatomic, readonly, strong, nullable) id alternativeRepresentation;
  34. @property (nonatomic, readonly, assign) NSTimeInterval requestDuration;
  35. @property (nonatomic, readonly, strong, nullable) NSError *error;
  36. @property (nonatomic, readonly, assign) PINRemoteImageResultType resultType;
  37. @property (nonatomic, readonly, strong, nullable) NSUUID *UUID;
  38. @property (nonatomic, readonly, assign) CGFloat renderedImageQuality;
  39. + (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image
  40. alternativeRepresentation:(nullable id)alternativeRepresentation
  41. requestLength:(NSTimeInterval)requestLength
  42. error:(nullable NSError *)error
  43. resultType:(PINRemoteImageResultType)resultType
  44. UUID:(nullable NSUUID *)uuid;
  45. + (nonnull instancetype)imageResultWithImage:(nullable PINImage *)image
  46. alternativeRepresentation:(nullable id)alternativeRepresentation
  47. requestLength:(NSTimeInterval)requestLength
  48. error:(nullable NSError *)error
  49. resultType:(PINRemoteImageResultType)resultType
  50. UUID:(nullable NSUUID *)uuid
  51. renderedImageQuality:(CGFloat)renderedImageQuality;
  52. @end