HUBImageLoaderDelegate

@protocol HUBImageLoaderDelegate <NSObject>

Delegate protocol for HUBImageLoader

You don’t conform to this protocol yourself. Instead, the Hub Framework will assign an internal object that conforms to this protocol as the delegate of any image loader. You use the methods defined in this protocol to communicate an image loader’s outcomes back to the framework.

  • Notify the Hub Framework that an image loader finished loading an image

    It’s safe to call this method from any thread, as the framework will automatically dispatch to the main queue in case it’s called from a background thread.

    Declaration

    Objective-C

    - (void)imageLoader:(nonnull id<HUBImageLoader>)imageLoader
           didLoadImage:(nonnull UIImage *)image
                 forURL:(nonnull NSURL *)imageURL;

    Parameters

    imageLoader

    The image loader that finished loading

    image

    The image that was loaded

    imageURL

    The URL of the image that was loaded

  • Notify the Hub Framework that an image loader failed to load an image because of an error

    It’s safe to call this method from any thread, as the framework will automatically dispatch to the main queue in case it’s called from a background thread.

    Declaration

    Objective-C

    - (void)imageLoader:(nonnull id<HUBImageLoader>)imageLoader
        didFailLoadingImageForURL:(nonnull NSURL *)imageURL
                            error:(nonnull NSError *)error;

    Parameters

    imageLoader

    The image loader that failed loading

    imageURL

    The URL of the image that failed to load

    error

    The error that was encountered