Latest 0.1.4
License MIT
Platforms ios 10.0

A library providing asynchronous image downloading utilities.


ASAPImageView is a subclass of UIImageView.

It handles fetching an image from an URL then asynchronously setting it as its image property.

Basic usage

import ASAPImage

let url: URL!

let asapImageView = ASAPImageView()
asapImageView.load(imageAt: url)

While a request is ongoing, any subsequent modification of the image, wether through a new call to load(imageAt:) or by setting the image property directly, will result in the cancellation of the ‘old’ request.

Request cancellation

The cancel() method allows you to cancel the ongoing request.

asapImageView.load(imageAt: url)

Request completion

load(imageAt:) accepts as an optional argument a callback to notify your code of the request’s completion.
The callback takes as an argument a Result<Void> type, which is an enum with .success and .failure(Error) cases.

asapImageView.load(imageAt: url) { result in
    switch result {
    case .success:
         /* your logic */
    case .failure(let error):
         /* your logic */

Cancelling a request will result with a .failure(Error) completion.


For pure image downloading you can use the ASAPImageLoader singleton.

In the same fashion as ASAPImageView, it provides a load(imageAt:completion:) method. This time the completion handler is obligatory and its argument is of type Result<Image>.

ASAPImageLoader.shared.load(imageAt: url) { result in
    switch result {
    case .success(let image):
         /* your logic */
    case .failure(let error):
         /* your logic */

Request cancellation

If you want to cancel a request you can use the CancellationToken returned by the load(imageAt:completion:) method.

let token = ASAPImageLoader.shared.load(imageAt: url) { /* your logic */ }

Installation with Cocoapods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. See the Get Started section for more details.


pod 'ASAPImage'

If you are using Swift, be sure to add use_frameworks!


Latest podspec

    "name": "ASAPImage",
    "version": "0.1.4",
    "summary": "Asynchronous image downloading utilities",
    "description": "A library providing asynchronous image downloading utilities.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Louis Fournier": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.4"
    "platforms": {
        "ios": "10.0"
    "source_files": [

Pin It on Pinterest

Share This