Skip to content

Images loaded with ImageDataProvider cannot be cancelled #2511

@FaizanDurrani

Description

@FaizanDurrani

Images being loaded asynchronously using an ImageDataProvider cannot be cancelled via imageView.kf.cancelDownloadTask(). Currently an alternative to this is to implement a custom cancel method on the ImageDataProvider and store a reference to it in the view that is using it and call dataProvider.cancel() on it instead.

This is a lot more verbose and error prone as someone who might be used to using cancelDownloadTask() may forget to explicitly call cancel on the image data provider (or if the view's image loading logic is abstracted out then it's difficult to support cancelling without introducing something like CancellableImageDataProvider which is a wrapper on ImageDataProvider).

An example usecase of this is implementing some custom protocol based image loading from network that may not be supported by default by Kingfisher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions