@@ -3,69 +3,63 @@ import SwiftUI
3
3
struct DownloadOverlayView : View {
4
4
@Binding var isShowing : Bool
5
5
@StateObject var viewModel : DownloadViewModel
6
-
6
+
7
7
var body : some View {
8
8
if isShowing {
9
9
ZStack {
10
10
Color . black. opacity ( 0.8 )
11
11
. edgesIgnoringSafeArea ( . all)
12
-
12
+
13
13
VStack {
14
+ Text ( " \( viewModel. completedDownloads) / \( Int ( viewModel. totalCourses) ) courses " )
15
+ . font ( . title2)
16
+ . foregroundColor ( . white)
17
+
14
18
CircularProgressView ( progress: $viewModel. overallProgress)
15
19
. frame ( width: 250 , height: 250 )
16
20
. shadow ( radius: 10 )
17
-
18
- HStack {
19
- if viewModel. totalCourses > 1 {
20
- Text ( " \( viewModel. completedDownloads) / \( Int ( viewModel. totalCourses) ) courses " )
21
- . font ( . headline)
22
- . foregroundColor ( . white)
23
- . padding ( . top, 10 )
24
- }
25
- }
26
-
27
- Text ( viewModel. statusMessage)
28
- . font ( . subheadline)
29
- . bold ( )
30
- . foregroundColor ( . white)
31
- . padding ( . top, 5 )
32
21
22
+ Text ( viewModel. statusMessage)
23
+ . font ( . subheadline)
24
+ . bold ( )
25
+ . foregroundColor ( . gray)
26
+ . padding ( . top, 10 )
33
27
}
34
28
}
35
29
}
36
30
}
37
- }
38
-
39
- struct CircularProgressView : View {
40
- @ Binding var progress : Double
41
-
42
- var body : some View {
43
- ZStack {
44
- Circle ( )
45
- . stroke ( lineWidth : 10.0 )
46
- . opacity ( 0.5 )
47
- . foregroundColor ( Color . customSecondary )
48
-
49
- Circle ( )
50
- . trim ( from : 0 .0, to : CGFloat ( min ( self . progress , 1.0 ) ) )
51
- . stroke ( style : StrokeStyle ( lineWidth : 10.0 , lineCap : . round , lineJoin : . round ) )
52
- . foregroundColor ( Color . customAccent )
53
- . rotationEffect ( Angle ( degrees : 270.0 ) )
54
- . animation ( . linear , value : progress )
55
-
56
- if progress < 1.0 {
57
- Text ( String ( format : " %.0f %% " , min ( self . progress , 1.0 ) * 100.0 ) )
58
- . font ( . largeTitle )
59
- . bold ( )
60
- } else {
61
- withAnimation ( . spring ( ) ) {
62
- Image ( systemName : " checkmark.circle.fill " )
63
- . resizable ( )
64
- . foregroundColor ( Color . correct )
65
- . frame ( width : 50 , height : 50 )
31
+
32
+ struct CircularProgressView : View {
33
+ @ Binding var progress : Double
34
+
35
+ var body : some View {
36
+ ZStack {
37
+ Circle ( )
38
+ . stroke ( lineWidth : 10.0 )
39
+ . opacity ( 0.5 )
40
+ . foregroundColor ( Color . customSecondary )
41
+
42
+ Circle ( )
43
+ . trim ( from : 0.0 , to : CGFloat ( min ( self . progress , 1.0 ) ) )
44
+ . stroke ( style : StrokeStyle ( lineWidth : 10 .0, lineCap : . round , lineJoin : . round ) )
45
+ . foregroundColor ( Color . customAccent )
46
+ . rotationEffect ( Angle ( degrees : 270.0 ) )
47
+ . animation ( . linear , value : progress )
48
+
49
+ if progress < 1.0 {
50
+ Text ( String ( format : " %.0f %% " , min ( self . progress , 1.0 ) * 100.0 ) )
51
+ . font ( . largeTitle )
52
+ . bold ( )
53
+ } else {
54
+ withAnimation ( . spring ( ) ) {
55
+ Image ( systemName : " checkmark.circle.fill " )
56
+ . resizable ( )
57
+ . foregroundColor ( Color . correct )
58
+ . frame ( width : 50 , height : 50 )
59
+ }
66
60
}
67
61
}
62
+ . padding ( 40 )
68
63
}
69
- . padding ( 40 )
70
64
}
71
65
}
0 commit comments