WebASDKImageManager 3.0.0

WebASDKImageManager 3.0.0

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Mar 2017

Maintained by James Ide.

Depends on:
AsyncDisplayKit/Core~> 2.0
SDWebImage/Core~> 4.0

  • By
  • James Ide


AsyncDisplayKit now uses Pinterest's PINRemoteImage and PINCache if you include them as dependencies. They provide the functionality that WebASDKImageManager originally set to provide and manage memory more efficiently because they work more tightly with AsyncDisplayKit. Unless you specifically wish to use SDWebImage, you should use AsyncDisplayKit's default functionality.

An image downloader and cache for AsyncDisplayKit that uses SDWebImage. This is an implementation of ASImageDownloaderProtocol and ASImageCacheProtocol that is compatible with ASNetworkImageNode.

By default, ASNetworkImageNode does not cache images and does not coalesce network requests for the same image. SDWebImage does both of these. With WebASDKImageManager, you get the image downloading and caching optimizations of SDWebImage and the asynchronous layout and layer precompositing features of ASDK.


WebASDKImageManager is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "WebASDKImageManager"


The easiest way to use WebASDKImageManager is an initializer it provides in a category on ASNetworkImageNode.

ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] initWithWebImage];
// Setting the URL property will automatically access the memory and disk
// caches, and download and cache the image if necessary
imageNode.URL = imageURL;


By default, image downloading and caching is handled by a shared WebASDKImageManager instance. You can get a reference to the shared manager by calling [SDWebASDKImageManager sharedManager]. Its webImageOptions property is the way to configure the downloading and caching behavior for all ASNetworkImageNode instances that used the shared manager.

SDWebASDKImageManager *defaultManager = [SDWebASDKImageManager sharedManager];
// No longer try to download images that were previously unavailable
defaultManager.webImageOptions &= ~SDWebImageRetryFailed;


The default options are SDWebImageRetryFailed and SDWebImageContinueInBackground, which are generally what you want. See SDWebImage's SDWebImageOptions enum for all of the supported options.

Configuring a Single Image Node

Sometimes you may want to configure an image node differently than the default. You can do this by creating a new WebASDKImageManager that is configured to meet your needs.

SDWebImageManager *webImageManager = [SDWebImageManager sharedManager];
SDWebASDKImageManager *asyncImageManager =
  [[SDWebASDKImageManager alloc] initWithWebImageManager:webImageManager];
asyncImageManager.webImageOptions = SDWebImageRetryFailed | SDWebImageCacheMemoryOnly;

WebASDKImageManager conforms to ASImageDownloaderProtocol and ASImageCacheProtocol, so you can use your new manager to create a new image node.

ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] initWithCache:asyncImageManager