Daily iOS
UIKit

Cell reuse and async images

You've inherited a UITableView feed where, on fast scrolling, images briefly show up in the wrong cell and then get replaced. What's the cause?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

Cells are reused, but the completion callback from the previous cell's async image request is applied to the reused cell as is. The callback captures the cell instance and runs regardless of which item the cell is showing now.

Share a question