Skip to content

Commit 2341575

Browse files
committed
Add the support for image data observable on ImageManager
1 parent 8e61e44 commit 2341575

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

SDWebImageSwiftUI/Classes/ImageManager.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import SDWebImage
1515
public final class ImageManager : ObservableObject {
1616
/// loaded image, note when progressive loading, this will published multiple times with different partial image
1717
@Published public var image: PlatformImage?
18+
/// loaded image data, may be nil if hit from memory cache. This will only published once even on incremental image loading
19+
@Published public var imageData: Data?
1820
/// loading error, you can grab the error code and reason listed in `SDWebImageErrorDomain`, to provide a user interface about the error reason
1921
@Published public var error: Error?
2022
/// whether network is loading or cache is querying, should only be used for indicator binding
@@ -87,6 +89,7 @@ public final class ImageManager : ObservableObject {
8789
self.error = error
8890
self.isIncremental = !finished
8991
if finished {
92+
self.imageData = data
9093
self.isLoading = false
9194
self.progress = 1
9295
if let image = image {

0 commit comments

Comments
 (0)