Skip to content

Commit 4097d56

Browse files
committed
Revert "Fix the indicator will create multiple times, only create once with binding"
This reverts commit 417f0fd.
1 parent a229aa6 commit 4097d56

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

SDWebImageSwiftUI/Classes/Indicator/Indicator.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public struct Indicator<T> where T : View {
2929
struct IndicatorViewModifier<T> : ViewModifier where T : View {
3030
@ObservedObject var imageManager: ImageManager
3131

32-
let indicatorView: T
32+
var indicator: Indicator<T>
3333

3434
func body(content: Content) -> some View {
3535
if !imageManager.isLoading {
@@ -40,17 +40,11 @@ struct IndicatorViewModifier<T> : ViewModifier where T : View {
4040
return AnyView(
4141
ZStack {
4242
content
43-
indicatorView
43+
indicator.builder($imageManager.isLoading, $imageManager.progress)
4444
}
4545
)
4646
}
4747
}
48-
49-
init(imageManager: ImageManager, indicator: Indicator<T>) {
50-
self.imageManager = imageManager
51-
// This syntax looks not Swifty, hope for SwiftUI better design
52-
self.indicatorView = indicator.builder(_imageManager.projectedValue.isLoading, _imageManager.projectedValue.progress)
53-
}
5448
}
5549

5650
#if os(macOS) || os(iOS) || os(tvOS)

0 commit comments

Comments
 (0)