Adds placeholderImage property to Row protocol#61
Open
simonmitchell wants to merge 1 commit intodevelopfrom
Open
Adds placeholderImage property to Row protocol#61simonmitchell wants to merge 1 commit intodevelopfrom
Row protocol#61simonmitchell wants to merge 1 commit intodevelopfrom
Conversation
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)
BenShutt
reviewed
Jul 22, 2020
| if _row.image == nil { | ||
| _row.image = image | ||
| welf.tableView.reloadRows(at: [indexPath], with: .none) | ||
| self?.tableView.reloadRows(at: [indexPath], with: .none) |
Contributor
There was a problem hiding this comment.
indexPath might not be the correct indexPath when this method comes back
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This solves an issue I was having with
didSetnot being called on a struct/class/enum implementing theRowprotocol.If you want the image view to have a placeholder image, previously the easiest way was to return this placeholder from the
imageproperty. However,ThunderTabledoes a check fornilon the row's image before settingimageafter an asynchronous image load and thereforedidSetonimagewas 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
Checklist: