@@ -36,6 +36,7 @@ public struct AnimatedImage : ViewRepresentable {
36
36
@ObservedObject var imageModel = AnimatedImageModel ( )
37
37
@ObservedObject var imageLayout = AnimatedImageLayout ( )
38
38
39
+ var placeholder : PlatformImage ?
39
40
var webOptions : SDWebImageOptions = [ ]
40
41
var webContext : [ SDWebImageContextOption : Any ] ? = nil
41
42
@@ -70,7 +71,7 @@ public struct AnimatedImage : ViewRepresentable {
70
71
func updateView( _ view: AnimatedImageViewWrapper , context: ViewRepresentableContext < AnimatedImage > ) {
71
72
view. wrapped. image = imageModel. image
72
73
if let url = imageModel. url {
73
- view. wrapped. sd_setImage ( with: url, placeholderImage: nil , options: webOptions, context: webContext, progress: { ( receivedSize, expectedSize, _) in
74
+ view. wrapped. sd_setImage ( with: url, placeholderImage: placeholder , options: webOptions, context: webContext, progress: { ( receivedSize, expectedSize, _) in
74
75
self . imageModel. progressBlock ? ( receivedSize, expectedSize)
75
76
} ) { ( image, error, cacheType, _) in
76
77
if let image = image {
@@ -261,6 +262,7 @@ extension AnimatedImage {
261
262
// Initializer
262
263
extension AnimatedImage {
263
264
public init ( url: URL ? , placeholder: PlatformImage ? = nil , options: SDWebImageOptions = [ ] , context: [ SDWebImageContextOption : Any ] ? = nil ) {
265
+ self . placeholder = placeholder
264
266
self . webOptions = options
265
267
self . webContext = context
266
268
self . imageModel. url = url
0 commit comments