@protocol SDAnimatedImageCoder <SDImageCoder, SDAnimatedImageProvider>

This is the animated image coder protocol for custom animated image class like SDAnimatedImage. Through it inherit from SDImageCoder. We currentlly only use the method canDecodeFromData: to detect the proper coder for specify animated image format.

  • Because animated image coder should keep the original data, we will alloc a new instance with the same class for the specify animated image data The init method should return nil if it can’t decode the specify animated image data to produce any frame. After the instance created, we may call methods in SDAnimatedImageProvider to produce animated image frame.



    - (nullable instancetype)
        initWithAnimatedImageData:(nullable NSData *)data
                          options:(nullable SDImageCoderOptions *)options;


    init?(animatedImageData data: Data?, options: [SDImageCoderOption : Any]? = nil)



    The animated image data to be decode


    A dictionary containing any animated decoding options (instance-level). Pass @{SDImageCoderDecodeScaleFactor: @(1.0)} to specify scale factor for animated image (each frames should use the same scale).

    Return Value

    A new instance to do animated decoding for specify image data