SDWebImageDownloaderOptions

enum SDWebImageDownloaderOptions {}

Downloader options

  • Put the download in the low queue priority and task priority.

    Declaration

    Objective-C

    SDWebImageDownloaderLowPriority = 1 << 0

    Swift

    static var lowPriority: SDWebImageDownloaderOptions { get }
  • This flag enables progressive download, the image is displayed progressively during download as a browser would do.

    Declaration

    Objective-C

    SDWebImageDownloaderProgressiveLoad = 1 << 1

    Swift

    static var progressiveLoad: SDWebImageDownloaderOptions { get }
  • By default, request prevent the use of NSURLCache. With this flag, NSURLCache is used with default policies.

    Declaration

    Objective-C

    SDWebImageDownloaderUseNSURLCache = 1 << 2

    Swift

    static var useNSURLCache: SDWebImageDownloaderOptions { get }
  • Call completion block with nil image/imageData if the image was read from NSURLCache And the error code is SDWebImageErrorCacheNotModified This flag should be combined with SDWebImageDownloaderUseNSURLCache.

    Declaration

    Objective-C

    SDWebImageDownloaderIgnoreCachedResponse = 1 << 3

    Swift

    static var ignoreCachedResponse: SDWebImageDownloaderOptions { get }
  • In iOS 4+, continue the download of the image if the app goes to background. This is achieved by asking the system for extra time in background to let the request finish. If the background task expires the operation will be cancelled.

    Declaration

    Objective-C

    SDWebImageDownloaderContinueInBackground = 1 << 4

    Swift

    static var continueInBackground: SDWebImageDownloaderOptions { get }
  • Handles cookies stored in NSHTTPCookieStore by setting NSMutableURLRequest.HTTPShouldHandleCookies = YES;

    Declaration

    Objective-C

    SDWebImageDownloaderHandleCookies = 1 << 5

    Swift

    static var handleCookies: SDWebImageDownloaderOptions { get }
  • Enable to allow untrusted SSL certificates. Useful for testing purposes. Use with caution in production.

    Declaration

    Objective-C

    SDWebImageDownloaderAllowInvalidSSLCertificates = 1 << 6

    Swift

    static var allowInvalidSSLCertificates: SDWebImageDownloaderOptions { get }
  • Put the download in the high queue priority and task priority.

    Declaration

    Objective-C

    SDWebImageDownloaderHighPriority = 1 << 7

    Swift

    static var highPriority: SDWebImageDownloaderOptions { get }
  • By default, images are decoded respecting their original size. On iOS, this flag will scale down the images to a size compatible with the constrained memory of devices. This flag take no effect if SDWebImageDownloaderAvoidDecodeImage is set. And it will be ignored if SDWebImageDownloaderProgressiveLoad is set.

    Declaration

    Objective-C

    SDWebImageDownloaderScaleDownLargeImages = 1 << 8

    Swift

    static var scaleDownLargeImages: SDWebImageDownloaderOptions { get }
  • By default, we will decode the image in the background during cache query and download from the network. This can help to improve performance because when rendering image on the screen, it need to be firstly decoded. But this happen on the main queue by Core Animation. However, this process may increase the memory usage as well. If you are experiencing a issue due to excessive memory consumption, This flag can prevent decode the image.

    Declaration

    Objective-C

    SDWebImageDownloaderAvoidDecodeImage = 1 << 9

    Swift

    static var avoidDecodeImage: SDWebImageDownloaderOptions { get }
  • By default, we decode the animated image. This flag can force decode the first frame only and produce the static image.

    Declaration

    Objective-C

    SDWebImageDownloaderDecodeFirstFrameOnly = 1 << 10

    Swift

    static var decodeFirstFrameOnly: SDWebImageDownloaderOptions { get }
  • By default, for SDAnimatedImage, we decode the animated image frame during rendering to reduce memory usage. This flag actually trigger preloadAllAnimatedImageFrames = YES after image load from network

    Declaration

    Objective-C

    SDWebImageDownloaderPreloadAllFrames = 1 << 11

    Swift

    static var preloadAllFrames: SDWebImageDownloaderOptions { get }
  • By default, when you use SDWebImageContextAnimatedImageClass context option (like using SDAnimatedImageView which designed to use SDAnimatedImage), we may still use UIImage when the memory cache hit, or image decoder is not available, to behave as a fallback solution. Using this option, can ensure we always produce image with your provided class. If failed, a error with code SDWebImageErrorBadImageData will been used. Note this options is not compatible with SDWebImageDownloaderDecodeFirstFrameOnly, which always produce a UIImage/NSImage.

    Declaration

    Objective-C

    SDWebImageDownloaderMatchAnimatedImageClass = 1 << 12

    Swift

    static var matchAnimatedImageClass: SDWebImageDownloaderOptions { get }