kaishin / Gifu

High-performance animated GIF support for iOS in Swift
Other
3.09k stars 279 forks source link

Static GIF Image not show properly #174

Open ruby109 opened 3 years ago

ruby109 commented 3 years ago

If you would like to display a static GIF Image(only 1 frame), the first frame is not added to the image. Also due to it's a static image, it can't be showed by the startAnimatingGIF() function.

There are two ways to show it, use GIFAnimatable's prepareForAnimation(withGIFData:loopCount:completionHandler:) or use other prepareForAnimation then call the updateImageIfNeeded().

I think maybe other function start with prepareForAnimation should also add code like imageContainer.image = UIImage(data: imageData) or the trick which is mentioned above should be added to the documentation.

kaishin commented 3 years ago

Thank you for opening the issue.

I haven't thought about this use case before, but I wonder if Gifu wouldn't be overkill for displaying static GIFs.

I would gladly consider a PR if the changes only minimally affect the API surface. Otherwise I would wait until the next major version since I am expecting some sizable refactors to take place.