SDWebImageSwiftUI
SDWebImageSwiftUI copied to clipboard
Feature request: access to ImagePlayer.animationFrameHandler
SDWebImageSwiftUI
Currently ImagePlayer does not expose the animationFrameHandler.
It would be very helpful if we can pass in a custom animationFrameHandler when using ImagePlayer.
Use cases:
- Track the current frame index during animation playback
- Implement custom progress UI or analytics
- Detect when the animation reaches the last frame (playback complete)
We wish to pass a custom animationFrameHandler through WebImage.
For example, it would be very useful if we could attach a handler for playback progress:
extension WebImage {
/// Example API to illustrate the idea
public func playProgress(_ handler: @escaping (_ currentIndex: Int, _ isLastIndex: Bool) -> Void) -> WebImage {
// ...
}
}
Seems it is easy if we expose SDImagePlayer (from SDWebImage Core) directly. You can grab this object and do custom animation by your own.
Your API sounds OK as well. Need some decision