Fix the case when SwiftUI create new View struct without call onAppears. Now we always do a query check when hitting empty Image
This commit is contained in:
parent
0c17688125
commit
152a321507
|
@ -18,6 +18,7 @@ profile
|
|||
DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
IDEWorkspaceChecks.plist
|
||||
|
||||
# Bundler
|
||||
.bundle
|
||||
|
|
|
@ -8,10 +8,10 @@ PODS:
|
|||
- libwebp/mux (1.0.3):
|
||||
- libwebp/demux
|
||||
- libwebp/webp (1.0.3)
|
||||
- SDWebImage (5.2.2):
|
||||
- SDWebImage/Core (= 5.2.2)
|
||||
- SDWebImage/Core (5.2.2)
|
||||
- SDWebImageSwiftUI (0.3.0):
|
||||
- SDWebImage (5.2.3):
|
||||
- SDWebImage/Core (= 5.2.3)
|
||||
- SDWebImage/Core (5.2.3)
|
||||
- SDWebImageSwiftUI (0.3.1):
|
||||
- SDWebImage (~> 5.1)
|
||||
- SDWebImageWebPCoder (0.2.5):
|
||||
- libwebp (~> 1.0)
|
||||
|
@ -22,7 +22,7 @@ DEPENDENCIES:
|
|||
- SDWebImageWebPCoder
|
||||
|
||||
SPEC REPOS:
|
||||
https://github.com/cocoapods/specs.git:
|
||||
trunk:
|
||||
- libwebp
|
||||
- SDWebImage
|
||||
- SDWebImageWebPCoder
|
||||
|
@ -33,10 +33,10 @@ EXTERNAL SOURCES:
|
|||
|
||||
SPEC CHECKSUMS:
|
||||
libwebp: 057912d6d0abfb6357d8bb05c0ea470301f5d61e
|
||||
SDWebImage: 5fcdb02cc35e05fc35791ec514b191d27189f872
|
||||
SDWebImageSwiftUI: 9fa220c3c9a69a383f2db5fabc97748ac4e4b696
|
||||
SDWebImage: 46a7f73228f84ce80990c786e4372cf4db5875ce
|
||||
SDWebImageSwiftUI: 1b67183dd2ef0321b2ccf578775de8e47eaceb77
|
||||
SDWebImageWebPCoder: 947093edd1349d820c40afbd9f42acb6cdecd987
|
||||
|
||||
PODFILE CHECKSUM: 3fb06a5173225e197f3a4bf2be7e5586a693257a
|
||||
|
||||
COCOAPODS: 1.7.5
|
||||
COCOAPODS: 1.8.3
|
||||
|
|
|
@ -45,6 +45,9 @@ public struct WebImage : View {
|
|||
let emptyImage = Image(uiImage: UIImage())
|
||||
#endif
|
||||
image = emptyImage
|
||||
// load remote image here, SwiftUI sometimes will create a new View struct without calling `onAppear` (like enter EditMode) :)
|
||||
// this can ensure we load the image, SDWebImage take care of the duplicated query
|
||||
self.imageManager.load()
|
||||
}
|
||||
return configurations.reduce(image) { (previous, configuration) in
|
||||
configuration(previous)
|
||||
|
|
Loading…
Reference in New Issue