Closed noais closed 7 years ago
Setting avatar
as a strong var
would create retain cycles when accessing the property inside a closure.
The goal of fix-image-scrambling
was to improve the behavior of the cell when it gets recycled (override func prepareForReuse()
) by:
avatar.image = nil
(this could also have been changed to avatar.setRoundedImage(UserCell.defaultAvatar)
).downloadTask?.cancel()
). This should prevent overwriting a cell with the wrong image.
The changes I made are not very efficient and I am planning to implement a better solution soon enough.
You right, thank you.
I saw better your code and I don't understand why you did the alteration on "fix-image-scrambling" commit?
Can you explain me why you simple put the avatar as a strong var?
@IBOutlet var avatar: UIImageView!