Skip to content

Supports onSuccess/onFailure/onProgress callback for WebImage/AnimatedImage #10

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

Merged
merged 2 commits into from
Oct 3, 2019

Conversation

dreampiggy
Copy link
Collaborator

These event callback is important for advanced usage, like current progress indicator implementation in our Demo.

One more tips:

Currently, the WebImage and AnimatedImage need to write twice code, because of the implementation detail, maybe in the future we can refactory with the sameless solution.

WebIamge: Using the SDWebImageManger API
AnimartedImage: Using the SDAnimatedImage+WebCache API

@@ -178,17 +189,10 @@ public struct AnimatedImage : ViewRepresentable {
view.setNeedsDisplay()
#endif
}

public func image(_ image: PlatformImage?) -> Self {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong API design. The WebImage and AnimatedImage should be immutable struct. If we want to change image, refresh the View Tree to provide another struct. Just like SwiftUI's tutorial or some other declarative framework (Flutter, React for example)

@dreampiggy dreampiggy merged commit b1940df into master Oct 3, 2019
@dreampiggy dreampiggy deleted the feature_on_success branch October 3, 2019 10:18
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.

1 participant