AWFImageAnimationLoader

Objective-C

@interface AWFImageAnimationLoader : NSObject

Swift

class AWFImageAnimationLoader : NSObject

AWFImageAnimationLoader is responsible for requesting and managing image data required for animating a series of images for animation playback.

  • The image requests that are currently active.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSArray *requests;

    Swift

    var requests: [Any]? { get }
  • Initializes an AWFImageAnimationLoader instance with the specified URL session manager and configuration.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithSessionManager:(id)sessionManager;

    Swift

    init(sessionManager: Any!)

    Parameters

    sessionManager

    The URL session manager to use for making requests

    Return Value

    A loader instance initialized with the session manager

  • Starts requesting imagery using the specified array of URLs.

    Declaration

    Objective-C

    - (void)loadImagesFromURLs:(nonnull NSArray<NSURL *> *)URLs
                      progress:(nonnull void (^)(NSUInteger,
                                                 NSURLSessionDataTask *_Nonnull,
                                                 UIImage *_Nonnull,
                                                 NSError *_Nonnull))progressBlock
                    completion:(nonnull void (^)(NSArray<UIImage *> *_Nonnull))
                                   completionBlock;

    Swift

    func loadImages(from URLs: [URL], progress progressBlock: @escaping (UInt, URLSessionDataTask, UIImage, Error) -> Void) async -> [UIImage]

    Parameters

    URLs

    The array of URLs to request

    progressBlock

    A block that is called each time an image from the array has been loaded

    completionBlock

    A block that is called when all requests have completed

  • Cancels all active requests, if any.

    Declaration

    Objective-C

    - (void)cancel;

    Swift

    func cancel()