SDWebImageSwiftUI
SDWebImageSwiftUI copied to clipboard
Animated Image in Widget not showing anything
I have tried to put an animated image in the Home widget
struct WidgetView: View {
var widgetDoc: SMWidget
var body: some View {
Color(.white)
AnimatedImage(url: URL(string: widgetDoc.gifSticker))
.onFailure { error in
print("Error \(error)")
}
.indicator(SDWebImageProgressIndicator.default)
.resizable()
.aspectRatio(contentMode: .fill)
.background(Color.white)
}
}
But it's not working and not displaying anything. Does anything wrong here or Do anything I have to add to make it work?
Try using WebImage(url:isAnimating:)
instead ?
This sounds like Apple banned UIViewRepresentable for WidgetKit. The AnimatedImage
use SDAnimatedImageView
, native UIKit for implemenetation.
@dreampiggy No, it's not working as well
Can you set breakpoint in
-[SDDisplayLink displayLinkDidRefresh:]
method ? (or -[SDAnimatedImagePlayer displayDidRefresh:]
)
I doubt, when using in WidgetKit envrionment, the CADisplayLink or NSTimer does not get any trigger.
@dreampiggy It's not going anywhere.
https://developer.apple.com/forums/thread/653471