Search code examples
iosswiftsdwebimage

how to do something right after downloading image using SDWebImage?


So, I want to show a message to the user right after an image is downloaded and set in ImageView. I am using SDWebImage. how to do that?

Here is my current code

    profilePictureImageView.sd_setImage(with: referenceImage, placeholderImage: UIImage(named: ImageName.defaultProfilePicture))

Solution

  • You can do it like this

    profilePictureImageView.sd_setImage(with: referenceImage, placeholderImage: UIImage(named: "cod_logo"), options: [.highPriority]) { (image, error, cashtype, url) in
        if image != nil{
            // Do something Here after load image
        }
        print(error) // Your error is here
    }