When using HanekeSwift with a table view, I can simply show an image inside a cell with:
cell.image.hnk_setImageFromURL(url!)
without any further control.
If I scroll the table view quickly, some cells will go off the screen without showing their images since these images are not downloaded yet.
Are the network requests for these off-screen cells cancelled by HanekwSwift automatically?
One of the HanekeSwift contributors told me that the answer is NO and I should call hnk_cancelSetImag
e in prepareForReuse
. Therefore, I added following lines in my class inherited from UITableViewCell
:
override func prepareForReuse() {
super.prepareForReuse()
compImage.hnk_cancelSetImage()
compImage.image = nil
}