Get immediate access to this and over 1,500+ other videos and books.

Boost your skills with a Beginner subscription. With over 60+ video courses and our core foundational programming books bundled in one subscription, it’s simply the best investment you can make in your development career.

Challenge: Download Images

Leverage the concepts learned in the previous lecture, but apply them towards downloading images corresponding to album artwork.


Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a Professional subscription.

Hello and welcome! Time for a little challenge for you. By now you should have a good idea about how to download a file using URLSession.

  let (downloadURL, response) = try await url)
guard let httpResponse = response as? HTTPURLResponse,
    httpResponse.statusCode == 200
else {
  throw ArtworkDownloadError.invalidResponse
do {
  return try Data(contentsOf: downloadURL)
} catch {
  throw ArtworkDownloadError.failedToDownloadArtwork
do {
  let data = try await downloader.downloadArtwork(at: artworkURL)
} catch {
guard let image = UIImage(data: data) else {
artworkImage = image
catch {