File tree 1 file changed +10
-4
lines changed
Sources/Shared/Extensions
1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,23 @@ extension View {
13
13
placeholder: Image ? = nil ,
14
14
option: Option = Option ( ) ,
15
15
completion: Completion ? = nil ) {
16
- if let placeholder = placeholder {
17
- option. imageDisplayer. display ( placeholder: placeholder, onto: self )
18
- }
19
-
20
16
cancelImageFetch ( )
21
17
22
18
self . imageFetcher = ImageFetcher (
23
19
downloader: option. downloaderMaker ( ) ,
24
20
storage: option. storageMaker ( )
25
21
)
26
22
23
+ var shouldSetPlaceholder = placeholder != nil
24
+
25
+ if let storage = option. storageMaker ( ) , let _ = try ? storage. entry ( forKey: url. absoluteString) {
26
+ shouldSetPlaceholder = false
27
+ }
28
+
29
+ if shouldSetPlaceholder, let placeholder = placeholder {
30
+ option. imageDisplayer. display ( placeholder: placeholder, onto: self )
31
+ }
32
+
27
33
self . imageFetcher? . fetch ( url: url, completion: { [ weak self] result in
28
34
guard let `self` = self else {
29
35
return
You can’t perform that action at this time.
0 commit comments