It's very clear from the session video how we can leverage cell configurations for information that is available synchronously, like titles for rows and locally-available images.
Are there recommendations for how to configure cells for asynchronously-loaded stuff, for example fetching a user's profile picture from the internet?
In the old style, we could subclass UITableViewCell and add an imageURL property, and then start loading the image immediately, with the ability to cancel the network request when prepareForReuse was called.
I can imagine some ways to put this logic into the data source, but I think we'd have to do index-path accounting (or something) to keep track of which network request belongs to which cell, in order to deal with updating the cell's configuration on successful completion, as well as cancelling if the cell is going to be reused before loading completes.
Are there better ways to approach this? Thanks!
Are there recommendations for how to configure cells for asynchronously-loaded stuff, for example fetching a user's profile picture from the internet?
In the old style, we could subclass UITableViewCell and add an imageURL property, and then start loading the image immediately, with the ability to cancel the network request when prepareForReuse was called.
I can imagine some ways to put this logic into the data source, but I think we'd have to do index-path accounting (or something) to keep track of which network request belongs to which cell, in order to deal with updating the cell's configuration on successful completion, as well as cancelling if the cell is going to be reused before loading completes.
Are there better ways to approach this? Thanks!