Skip to content
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

Adds placeholderImage property to Row protocol #61

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

simonmitchell
Copy link
Contributor

Description

This solves an issue I was having with didSet not being called on a struct/class/enum implementing the Row protocol.

If you want the image view to have a placeholder image, previously the easiest way was to return this placeholder from the image property. However, ThunderTable does a check for nil on the row's image before setting image after an asynchronous image load and therefore didSet on image was never called!

Motivation and Context

Solves problems around loading images for rows

How Has This Been Tested?

Has been tested in the example project

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.

this allows us to return a placeholder image and still have
our `image.didSet` called on custom implementers of the
`Row` protocol, whereas before it wouldn't be called because
to provide a placeholder `image` would have to return
the placeholder itself (or we'd have to manually set it in
the configure function)
_row.image = image
welf.tableView.reloadRows(at: [indexPath], with: .none)
self?.tableView.reloadRows(at: [indexPath], 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.

indexPath might not be the correct indexPath when this method comes back

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.

None yet

2 participants