File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -28,17 +28,18 @@ extension QueenfisherWrapper where Base: QFImageView {
28
28
startIndicator ( indicator)
29
29
30
30
let maybeCache = imageCache ( performance: performance)
31
-
32
- maybeCache. fetch ( at: url) { data in
31
+
32
+ maybeCache. fetch ( at: url) { cacheableImage in
33
33
DispatchQueue . main. async {
34
34
defer { self . stopIndicator ( indicator) }
35
35
completion ? ( . zero)
36
36
37
- guard let data else {
37
+ guard let cacheableImage else {
38
38
base. image = placeholder
39
39
completion ? ( base. image? . size ?? . zero)
40
40
return
41
41
}
42
+ let data = cacheableImage. imageData
42
43
43
44
if downsampling {
44
45
self . base. image = data. imageWithDownsampling (
@@ -82,8 +83,16 @@ extension QueenfisherWrapper where Base: QFImageView {
82
83
}
83
84
84
85
private final class NoImageCache : ImageCacheProtocol {
85
-
86
- func fetch( at url: URL , completion: @escaping ( Data ? ) -> Void ) {
87
- self . fetchImage ( at: url, completion: completion)
86
+ func fetch( at url: URL , completion: @escaping ( CacheableImage ? ) -> Void ) {
87
+ self . fetchImage ( at: url, etag: nil ) { result in
88
+ switch result {
89
+ case . success( let success) :
90
+ completion ( success)
91
+ return
92
+ case . failure:
93
+ completion ( nil )
94
+ return
95
+ }
96
+ }
88
97
}
89
98
}
You can’t perform that action at this time.
0 commit comments