iOS Easiest way


Example

The most simple way to create this is to use Alamofire and its UIImageViewExtension. What we need is a tableview with a cell that has an imageView in it and lets call it imageView.

In the cellForRowAt: function of the tableView we would download the image and set in the following way:

let url = URL(string: "https://httpbin.org/image/png")!
let placeholderImage = UIImage(named: "placeholder")!

imageView.af_setImage(withURL: url, placeholderImage: placeholderImage)

The url should point to the image that you want to download and the placeHolder image should be a stored image. We then call the af_setImage method on the imageView which downloads the image at the given url and during the download the placeholder image will be shown. As soon as the image is downloaded the requested image is displayed