Swift UITableViewCell Temporary Image While Downloading Image From API



The goal of this article:

1.     Explain how to build a UITableViewCell that inserts a temporary image with a spinner while it's downloading another image. Then replace the spinner with the new image

2.     Hold reference to the applications that make this happen: the Swift iOS application and the Flask API that supplies the images.


The gif below displays what is actually going on. The iOS application opens to a page where the user first clicks “Get Posts” so to get the data that will populate the UITableView.


Then the user clicks on “Go To Table”. This will segue the user to the next UIViewController subclass RinconVC. This VC has a UITableView with custom cells that use the already downloaded post data and call the same API (different endpoint) to get the image data. While the images are being downloaded, we place a temporary image with a spinner to let the user know the application is working on getting the images. The API has as 3 second wait to show the spinner working.


When the image is finally downloaded the spinner and the view containing the spinner are removed.





Repo for API: apiEndpoints02

Repo for Swift iOS application: UITableViewCell-StackView04


The API repo might need to have tuRincon_modules added to the environment.