LOTAnimatedImage

@interface LOTAnimatedImage : UIImage <SDAnimatedImage>

A wrapper class to allow LOTComposition to be compatible for SDWebImage loading/cache/rendering system. The GIF image loading from LOTCompositionView+WebCache category, will use this subclass instead of UIImage.

Note

Though this class conforms to SDAnimatedImage protocol, so it’s compatible to be used for SDAnimatedImageView. But it’s normally discouraged to do so. Because it does not provide optimization for animation rendering. Instead, use SDAnimatedImage class with SDAnimatedImageView.

Note

If you want to get the bitmap version of Lottie animation at specify frame, call animatedImageFrameAtIndex: will result a snapshot for frame.
  • The LOTComposition instance for Lottie representation.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic, nullable) LOTComposition *composition;

    Swift

    var composition: LOTComposition? { get }
  • Create the wrapper with specify LOTComposition instance. The instance should be nonnull. This is a convenience method for some use cases, for example, create a placeholder with LOTComposition.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithComposition:
        (nonnull LOTComposition *)composition;

    Swift

    init(composition: LOTComposition)

    Parameters

    composition

    The LOTComposition instance

    Return Value

    An initialized object

  • Declaration

    Objective-C

    + (nullable instancetype)imageWithContentsOfFile:(nonnull NSString *)path;
  • Declaration

    Objective-C

    + (nullable instancetype)imageWithData:(nonnull NSData *)data;
  • Declaration

    Objective-C

    + (nullable instancetype)imageWithData:(nonnull NSData *)data scale:(CGFloat)scale;
  • Declaration

    Objective-C

    - (nullable instancetype)initWithContentsOfFile:(nonnull NSString *)path;

    Swift

    init?(contentsOfFile path: String)
  • Declaration

    Objective-C

    - (nullable instancetype)initWithData:(nonnull NSData *)data;

    Swift

    init?(data: Data)
  • Declaration

    Objective-C

    - (nullable instancetype)initWithData:(nonnull NSData *)data scale:(CGFloat)scale;

    Swift

    init?(data: Data, scale: CGFloat)