SDWebImage
SDWebImage copied to clipboard
Fix `sd_imageFormat` sometimes returns `undefined`
New Pull Request Checklist
-
[x] I have read and understood the CONTRIBUTING guide
-
[x] I have read the Documentation
-
[x] I have searched for a similar pull request in the project and found none
-
[x] I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)
-
[ ] I have added the required tests to prove the fix/feature I am adding
-
[x] I have updated the documentation (if necessary)
-
[ ] I have run the tests and they pass
-
[ ] I have run the lint and it passes (
pod lib lint
)
This merge request fixes:
sd_imageFormat
returns nil when used on SDAnimatedImage
to which static image were loaded.
Pull Request Description
When a static image is loaded into SDAnimatedImage
, the sd_imageFormat
remains unset. As a result, the associated object on the underlying UIImage
is not present. This value is typically assigned by decoders; for instance, SDImageIOCoder
does so here. However, with SDAnimatedImage
, the correct format is returned only if the animatedImageData
is included.
I’m uncertain if my solution is accurate (I’ve tested it, but I’m unsure if it’s the right approach). I’ve opened this PR to initiate a discussion on how to properly address that issue.