@@ -54,45 +54,44 @@ public struct IndicatorViewModifier<T> : ViewModifier where T : View {
54
54
55
55
public func body( content: Content ) -> some View {
56
56
ZStack {
57
- content. overlay ( overlay, alignment: . center)
57
+ content
58
+ overlay
58
59
}
59
60
}
60
61
}
61
62
62
- #if os(macOS) || os(iOS) || os(tvOS)
63
63
@available ( iOS 14 . 0 , OSX 11 . 0 , tvOS 14 . 0 , watchOS 7 . 0 , * )
64
- extension Indicator where T == ActivityIndicator {
64
+ extension Indicator where T == AnyView {
65
65
/// Activity Indicator
66
- public static var activity : Indicator {
66
+ public static var activity : Indicator < T > {
67
67
Indicator { isAnimating, _ in
68
- ActivityIndicator ( isAnimating)
68
+ AnyView ( ProgressView ( ) . opacity ( isAnimating. wrappedValue ? 1 : 0 ) )
69
69
}
70
70
}
71
71
72
72
/// Activity Indicator with style
73
73
/// - Parameter style: style
74
- public static func activity( style : ActivityIndicator . Style ) -> Indicator {
74
+ public static func activity( configuration : ProgressViewStyleConfiguration ) -> Indicator < T > {
75
75
Indicator { isAnimating, _ in
76
- ActivityIndicator ( isAnimating, style : style )
76
+ AnyView ( ProgressView ( configuration ) . opacity ( isAnimating. wrappedValue ? 1 : 0 ) )
77
77
}
78
78
}
79
79
}
80
80
81
81
@available ( iOS 14 . 0 , OSX 11 . 0 , tvOS 14 . 0 , watchOS 7 . 0 , * )
82
- extension Indicator where T == ProgressIndicator {
82
+ extension Indicator where T == AnyView {
83
83
/// Progress Indicator
84
- public static var progress : Indicator {
84
+ public static var progress : Indicator < T > {
85
85
Indicator { isAnimating, progress in
86
- ProgressIndicator ( isAnimating , progress: progress )
86
+ AnyView ( ProgressView ( value : progress. wrappedValue ) . opacity ( isAnimating . wrappedValue ? 1 : 0 ) )
87
87
}
88
88
}
89
89
90
90
/// Progress Indicator with style
91
91
/// - Parameter style: style
92
- public static func progress( style : ProgressIndicator . Style ) -> Indicator {
92
+ public static func progress( configuration : ProgressViewStyleConfiguration ) -> Indicator < T > {
93
93
Indicator { isAnimating, progress in
94
- ProgressIndicator ( isAnimating, progress : progress , style : style )
94
+ AnyView ( ProgressView ( configuration ) . opacity ( isAnimating. wrappedValue ? 1 : 0 ) )
95
95
}
96
96
}
97
97
}
98
- #endif
0 commit comments