@@ -10,15 +10,15 @@ import SwiftUI
10
10
11
11
/// The app's entry point view.
12
12
struct MainView : View {
13
-
13
+
14
14
// MARK: - Properties
15
-
15
+
16
16
@State private var selectedTab : Screen = . home
17
17
@StateObject var tabBarProp = TabBarProperty ( )
18
18
@StateObject private var viewModel = ViewModel ( )
19
19
20
20
// MARK: - UI
21
-
21
+
22
22
var body : some View {
23
23
ZStack {
24
24
VStack ( spacing: 0 ) {
@@ -36,12 +36,12 @@ struct MainView: View {
36
36
. overlay ( alignment: . bottom) {
37
37
!tabBarProp. hidden ? tabBar. transition ( . move( edge: . bottom) ) : nil
38
38
}
39
-
39
+
40
40
if viewModel. popUpGiveaway {
41
41
Constants . Colors. gray04
42
42
. opacity ( 0.4 )
43
43
. ignoresSafeArea ( . all)
44
-
44
+
45
45
GiveawayPopup (
46
46
didClickSubmit: $viewModel. didClickSubmit,
47
47
instagram: $viewModel. instagram,
@@ -67,19 +67,19 @@ struct MainView: View {
67
67
}
68
68
}
69
69
}
70
-
70
+
71
71
private var tabBar : some View {
72
72
HStack {
73
73
Spacer ( )
74
-
74
+
75
75
tabItem ( for: . home)
76
-
76
+
77
77
Spacer ( )
78
-
78
+
79
79
tabItem ( for: . classes)
80
-
80
+
81
81
Spacer ( )
82
-
82
+
83
83
tabItem ( for: . profile)
84
84
85
85
Spacer ( )
@@ -88,7 +88,7 @@ struct MainView: View {
88
88
. background ( Constants . Colors. yellow)
89
89
. ignoresSafeArea ( . all)
90
90
}
91
-
91
+
92
92
@ViewBuilder
93
93
private func tabItem( for screen: Screen ) -> some View {
94
94
switch screen {
@@ -122,31 +122,31 @@ struct MainView: View {
122
122
}
123
123
}
124
124
}
125
-
125
+
126
126
private func tabItemView( icon: Image , name: String ) -> some View {
127
127
VStack {
128
128
icon
129
129
. resizable ( )
130
130
. scaledToFit ( )
131
131
. frame ( width: 24 , height: 24 )
132
-
132
+
133
133
Text ( name)
134
134
. font ( Constants . Fonts. h3)
135
135
}
136
136
. foregroundStyle ( Constants . Colors. black)
137
137
}
138
-
138
+
139
139
}
140
140
141
141
extension MainView {
142
-
142
+
143
143
/// An enumeration to keep track of which tab the user is currently on.
144
144
private enum Screen {
145
145
case home
146
146
case classes
147
147
case profile
148
148
}
149
-
149
+
150
150
}
151
151
152
152
final class TabBarProperty : ObservableObject {
0 commit comments