Vitor Venturin
Vitor Venturin

Reputation: 77

iOS / Swift - Download image using AWS3 (Amazon SDK) asynchronously into a collection view

Simple question: I have a struct that is a JSON fetched from server and I have a field called "imagePathFromAWS3", like this:

struct Card {
  let id: Int?
  let name: String?
  let imagePathFromAWS3: String?
}

Then, I want to present this information inside a CardCollectionView but I want to do that asynchronously because once the card is shown in the collection, I fetch the preview image from Amazon AWS3.

What is the best way to do that? Using AWSTask to create promises? Using Dispatches?

Upvotes: 1

Views: 144

Answers (1)

Lind el Loren
Lind el Loren

Reputation: 115

I would use https://github.com/kean/Nuke for this. Works pretty well and will save you a lot of time.

Just pod it and use it like this:

nukeLoad(imgUrl: imagePathFromAWS3, into: cell.imageContainer)

Upvotes: 1

Related Questions