@@ -36,6 +36,9 @@ final class AnimatedImageConfiguration: ObservableObject {
3636 @Published var incrementalLoad : Bool ?
3737 @Published var maxBufferSize : UInt ?
3838 @Published var customLoopCount : Int ?
39+ // These configurations only useful for web image loading
40+ @Published var indicator : SDWebImageIndicator ?
41+ @Published var transition : SDWebImageTransition ?
3942}
4043
4144// Convenient
@@ -203,6 +206,8 @@ public struct AnimatedImage : PlatformViewRepresentable {
203206 #endif
204207 } else {
205208 if let url = url {
209+ view. wrapped. sd_imageIndicator = imageConfiguration. indicator
210+ view. wrapped. sd_imageTransition = imageConfiguration. transition
206211 loadImage ( view, url: url)
207212 }
208213 }
@@ -545,6 +550,26 @@ extension AnimatedImage {
545550 }
546551}
547552
553+ // Web Image convenience
554+ extension AnimatedImage {
555+
556+ /// Associate a indicator when loading image with url
557+ /// - Note: If you do not need indicator, specify nil. Defaults to nil
558+ /// - Parameter indicator: indicator, see more in `SDWebImageIndicator`
559+ public func indicator( _ indicator: SDWebImageIndicator ? ) -> AnimatedImage {
560+ imageConfiguration. indicator = indicator
561+ return self
562+ }
563+
564+ /// Associate a transition when loading image with url
565+ /// - Note: If you specify nil, do not do transition. Defautls to nil.
566+ /// - Parameter transition: transition, see more in `SDWebImageTransition`
567+ public func transition( _ transition: SDWebImageTransition ? ) -> AnimatedImage {
568+ imageConfiguration. transition = transition
569+ return self
570+ }
571+ }
572+
548573#if DEBUG
549574struct AnimatedImage_Previews : PreviewProvider {
550575 static var previews : some View {
0 commit comments