Skip to content

Feature/image loading callback improvements #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 14, 2020

Conversation

simonmitchell
Copy link
Contributor

Description

Makes sure image load completion is called even due to cancellation of requests

Motivation and Context

Had an issue in apps where the completion for loading an image was never called in some cases. This resolves the issue.

How Has This Been Tested?

Has been tested in my personal app Camrote.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

… view

so the closure sent to the method is always called even if multiple requests
are made in quick succession. This guarantees callers of this method
will always get the completion handler called, even if it was simply cancelled
Doesn't reload row unless image is actually fetched
Doesn't try to load image unless `imageURL` is provided
indexPathsToReload.append(indexPath)
}
guard !indexPathsToReload.isEmpty else { return }
self.tableView.reloadRows(at: indexPathsToReload, with: .none)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@simonmitchell Did you mean to pass animation here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops yep!

@simonmitchell simonmitchell merged commit 4b8d048 into develop Aug 14, 2020
@BenShutt BenShutt deleted the feature/image_loading_callback_improvements branch August 25, 2022 09:36
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