SDWebImage / SDWebImageSwiftUI

SwiftUI Image loading and Animation framework powered by SDWebImage
https://sdwebimage.github.io/SDWebImageSwiftUI
MIT License
2.1k stars 216 forks source link

[URGENT] onProgress Callback not called / Indicator not showing #258

Open Dave181295 opened 1 year ago

Dave181295 commented 1 year ago
WebImage(url: relation.imageUrl ?? URL(string: ""))
       .resizable()
       .placeholder(Image(systemName: "person.circle.fill")) 
       .indicator(.activity(style: .large))
       .transition(.fade(duration: 0.5))
       .scaledToFit()
       .frame(maxWidth: UIDevice.isIPad  ? 72 : 48, maxHeight: UIDevice.isIPad  ? 72 : 48)
       .clipShape(Circle())

The view is triggered again with the updated image when the URL is not nil, but can't figure why the loading indicator is not showing, even with a custom one.

iOS 16+ iPhone 14 Pro

Dave181295 commented 1 year ago

Update

The onProgress callback is not called. I get directly Failure then Success, I tried to pass a Binding wrapped value, but still same problem.

dreampiggy commented 1 year ago

Seems by design?...

If the network directly failed, current UIKit-based SDWebImage's manager or sd_setImage(on UIImageView) always ignore any progress callback.

The progress block, actually, only useful when image is from network. (if it from disk cache there are no any callback in history)

Why is this import to you ?

Dave181295 commented 1 year ago

Image is from network. it's first nil, and then the url is changing to retrieve an image. in this time I need a callback progress so the placeholder shows a loader... and finally the wanted image from the URL. in other words its needed to listen to the url changes @dreampiggy

Dave181295 commented 1 year ago

The URL is listening to changes, please friend make also the onProgressCallback to trigger when changing the url. @dreampiggy