Skip to content

Conversation

@PortoCode
Copy link
Owner

Capture cell reference and load/reload cell resources on willDisplayCell as a fix for iOS 15 cell prefetching behavior change.

Background: On iOS 15+, for performance reasons, the table view data source may not recreate a cell using the cellForRow method if there's a cached cell for the given IndexPath. In this case, it'll just call willDisplayCell. However, we release a reference of the cell and cancel requests on didEndDisplayingCell.

So, since cellForRow may not be called anymore, we need to implement willDisplayCell to know when the cached cell is becoming visible again to recapture a reference of the cell and load/reload any resource needed for the cell.

…Cell` as a fix for iOS 15 cell prefetching behavior change. On iOS 15+, for performance reasons, the table view data source may not recreate a cell using the `cellForRow` method if there's a cached cell for the given IndexPath. In this case, it'll just call `willDisplayCell`. However, we release a reference of the cell and cancel requests on `didEndDisplayingCell`. So, since `cellForRow` may not be called, we need to implement `willDisplayCell` to know when the cached cell is becoming visible again to recapture a reference of the cell and load/reload any resource needed for the cell.
@PortoCode PortoCode self-assigned this Mar 18, 2025
@PortoCode PortoCode merged commit d6dfbf5 into main Mar 18, 2025
2 checks passed
@PortoCode PortoCode deleted the fix/ios15 branch March 18, 2025 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants