File tree 1 file changed +19
-9
lines changed
OUDS/Core/Components/Sources/Buttons/Internal
1 file changed +19
-9
lines changed Original file line number Diff line number Diff line change 2
2
// Software Name: OUDS iOS
3
3
// SPDX-FileCopyrightText: Copyright (c) Orange SA
4
4
// SPDX-License-Identifier: MIT
5
- //
5
+ //
6
6
// This software is distributed under the MIT license,
7
7
// the text of which is available at https://opensource.org/license/MIT/
8
8
// or see the "LICENSE" file for more details.
9
- //
9
+ //
10
10
// Authors: See CONTRIBUTORS.txt
11
- // Software description: A SwiftUI components library with code examples for Orange Unified Design System
11
+ // Software description: A SwiftUI components library with code examples for Orange Unified Design System
12
12
//
13
13
14
14
import OUDS
@@ -26,18 +26,28 @@ private struct LoagingIndicator: View {
26
26
27
27
@State private var isAnimating = false
28
28
29
+ @Environment ( \. accessibilityReduceMotion) var reduceMotion
30
+
29
31
// MARK: Body
30
32
31
33
var body : some View {
34
+ if reduceMotion {
35
+ circleView ( )
36
+ } else {
37
+ circleView ( )
38
+ . rotationEffect ( . degrees( isAnimating ? 360 : 0 ) )
39
+ . onAppear {
40
+ withAnimation ( Animation . linear ( duration: 1 ) . repeatForever ( autoreverses: false ) ) {
41
+ self . isAnimating. toggle ( )
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ private func circleView( ) -> some View {
32
48
Circle ( )
33
49
. trim ( from: 0 , to: 0.7 )
34
50
. stroke ( color, lineWidth: 3 )
35
- . rotationEffect ( . degrees( isAnimating ? 360 : 0 ) )
36
- . onAppear {
37
- withAnimation ( Animation . linear ( duration: 1 ) . repeatForever ( autoreverses: false ) ) {
38
- self . isAnimating. toggle ( )
39
- }
40
- }
41
51
}
42
52
}
43
53
You can’t perform that action at this time.
0 commit comments