File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
SDWebImageSwiftUI/Classes/Indicator Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public struct Indicator<T> where T : View {
29
29
struct IndicatorViewModifier < T> : ViewModifier where T : View {
30
30
@ObservedObject var imageManager : ImageManager
31
31
32
- var indicator : Indicator < T >
32
+ let indicatorView : T
33
33
34
34
func body( content: Content ) -> some View {
35
35
if ( imageManager. image != nil ) && !imageManager. isLoading {
@@ -40,11 +40,17 @@ struct IndicatorViewModifier<T> : ViewModifier where T : View {
40
40
return AnyView (
41
41
ZStack {
42
42
content
43
- indicator . builder ( $imageManager . isLoading , $imageManager . progress )
43
+ indicatorView
44
44
}
45
45
)
46
46
}
47
47
}
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
+ }
48
54
}
49
55
50
56
#if os(macOS) || os(iOS) || os(tvOS)
You can’t perform that action at this time.
0 commit comments