BU_SDWebImageDownloaderRequestModifier.h 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * This file is part of the SDWebImage package.
  3. * (c) Olivier Poitrey <rs@dailymotion.com>
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. */
  8. #import <Foundation/Foundation.h>
  9. #import "BU_SDWebImageCompat.h"
  10. typedef NSURLRequest * _Nullable (^SDWebImageDownloaderRequestModifierBlock)(NSURLRequest * _Nonnull request);
  11. /**
  12. This is the protocol for downloader request modifier.
  13. We can use a block to specify the downloader request modifier. But Using protocol can make this extensible, and allow Swift user to use it easily instead of using `@convention(block)` to store a block into context options.
  14. */
  15. @protocol SDWebImageDownloaderRequestModifier <NSObject>
  16. - (nullable NSURLRequest *)modifiedRequestWithRequest:(nonnull NSURLRequest *)request;
  17. @end
  18. /**
  19. A downloader request modifier class with block.
  20. */
  21. @interface BU_SDWebImageDownloaderRequestModifier : NSObject <SDWebImageDownloaderRequestModifier>
  22. - (nonnull instancetype)initWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block;
  23. + (nonnull instancetype)requestModifierWithBlock:(nonnull SDWebImageDownloaderRequestModifierBlock)block;
  24. @end