Merge pull request #12 from SDWebImage/little_binding_api_change

Use the @Published instead of hard-written protocol implementation
This commit is contained in:
DreamPiggy 2019-10-04 16:30:51 +08:00 committed by GitHub
commit 2997c45f2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 9 deletions

View File

@ -7,22 +7,14 @@
*/ */
import SwiftUI import SwiftUI
import Combine
import SDWebImage import SDWebImage
class ImageManager : ObservableObject { class ImageManager : ObservableObject {
@Published var image: PlatformImage?
var objectWillChange = PassthroughSubject<ImageManager, Never>()
var manager = SDWebImageManager.shared var manager = SDWebImageManager.shared
weak var currentOperation: SDWebImageOperation? = nil weak var currentOperation: SDWebImageOperation? = nil
var image: PlatformImage? {
willSet {
objectWillChange.send(self)
}
}
var url: URL? var url: URL?
var options: SDWebImageOptions var options: SDWebImageOptions
var context: [SDWebImageContextOption : Any]? var context: [SDWebImageContextOption : Any]?