I'm observing a bizarre thing: in the new widgets far too often remote images are not being displayed even though the image has been successfully loaded and placed in cache.
For image downloading I've tried:
- SDWebImageSwiftUI
- Kingfisher
- SwURL
All of them indicate that image loading succeed, but the actual widget is not showing it.
struct TestWidgetEntryView : View {
var entry: Provider.Entry
var body: some View {
WebImage(url: URL(string: "https://miro.medium.com/max/3840/0*TLqp5Uwavd-U_xrs.jpg"))
.onSuccess()
.resizable()
}
}
On the second run of the debugger - with image loading from cache - I get the image displayed, but never(?) on initial run.
It feels like that in onSuccess I need to trigger UI-invalidation? But how?
(Since it happens to literally every image-lib I try - I don't think that it's something off in the libs)
Environment:
- iOS 14 Beta 3 (both device and simulators)
- Xcode 12 Beta 3
- During the debug run, memory use is around 15mb
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…