Skip to content

Commit 395f0e6

Browse files
committed
Simplify the code for WebImage platform image convention
1 parent caebf49 commit 395f0e6

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

SDWebImageSwiftUI/Classes/WebImage.swift

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ public struct WebImage : View {
6969
if imageManager.image != nil {
7070
if isAnimating && !self.imageManager.isIncremental {
7171
if currentFrame != nil {
72-
configurations.reduce(Image(platformImage: currentFrame!)) { (previous, configuration) in
73-
configuration(previous)
74-
}
72+
configure(image: Image(platformImage: currentFrame!))
7573
.onAppear {
7674
self.imagePlayer?.startPlaying()
7775
}
@@ -86,22 +84,16 @@ public struct WebImage : View {
8684
}
8785
}
8886
} else {
89-
configurations.reduce(Image(platformImage: imageManager.image!)) { (previous, configuration) in
90-
configuration(previous)
91-
}
87+
configure(image: Image(platformImage: imageManager.image!))
9288
.onReceive(imageManager.$image) { image in
9389
self.setupPlayer(image: image)
9490
}
9591
}
9692
} else {
9793
if currentFrame != nil {
98-
configurations.reduce(Image(platformImage: currentFrame!)) { (previous, configuration) in
99-
configuration(previous)
100-
}
94+
configure(image: Image(platformImage: currentFrame!))
10195
} else {
102-
configurations.reduce(Image(platformImage: imageManager.image!)) { (previous, configuration) in
103-
configuration(previous)
104-
}
96+
configure(image: Image(platformImage: imageManager.image!))
10597
}
10698
}
10799
} else {
@@ -268,9 +260,7 @@ extension WebImage {
268260
/// - Parameter image: A Image view that describes the placeholder.
269261
public func placeholder(_ image: Image) -> WebImage {
270262
return placeholder {
271-
configurations.reduce(image) { (previous, configuration) in
272-
configuration(previous)
273-
}
263+
configure(image: image)
274264
}
275265
}
276266

0 commit comments

Comments
 (0)