@@ -16,28 +16,30 @@ public struct HomeView: View {
1616 @Bindable var store : StoreOf < HomeFeature >
1717
1818 // MARK: - Layout Constants
19- private enum LayoutConstants {
20- static let heroHeight : CGFloat = 524
21- static let pickerWidth : CGFloat = 176
22- static let pickerHeight : CGFloat = 180
23- static let pickerOffset = UIOffset ( horizontal: - 184 , vertical: 492 )
24- static let timeCapsuleHeight : CGFloat = 77
25- static let cornerRadius : CGFloat = 28
26- static let heroCornerRadius : CGFloat = 40
27- static let timeLeftCornerRadius : CGFloat = 36
28- }
19+ private enum Layout {
20+ enum Hero {
21+ static let height : CGFloat = 524
22+ static let cornerRadius : CGFloat = 40
23+ }
24+
25+ enum TimePicker {
26+ static let width : CGFloat = 176
27+ static let height : CGFloat = 180
28+ static let offset = UIOffset ( horizontal: - 184 , vertical: 492 )
29+ static let cornerRadius : CGFloat = 28
30+ }
2931
30- // MARK: - String Constants (μ€λΉ: ν₯ν κ΅μ νμ©)
31- private enum Strings {
32- static let currentTime = " νμ¬ μκ° "
33- static let departureTime = " μΆλ° μκ° "
34- static let hours = " HOURS "
35- static let minutes = " MINUTES "
36- static let exploreNearby = " μ£Όλ³ νμ μμνκΈ° "
37- static let departureTimeSelection = " μΆλ° μκ° μ ν "
38- static let insufficientWaitTime = " λκΈ° μκ°μ΄ λΆμ‘±ν©λλ€ (μ΅μ 20λΆ νμ) "
32+ enum TimeCapsule {
33+ static let height : CGFloat = 77
34+ static let cornerRadius : CGFloat = 28
35+ }
36+
37+ enum TimeDisplay {
38+ static let cornerRadius : CGFloat = 36
39+ }
3940 }
4041
42+
4143 public init ( store: StoreOf < HomeFeature > ) {
4244 self . store = store
4345 }
@@ -79,7 +81,7 @@ public struct HomeView: View {
7981 }
8082 . onChange ( of: store. shouldShowDepartureWarningToast) { _, shouldShow in
8183 guard shouldShow else { return }
82- ToastManager . shared. showWarning ( Strings . insufficientWaitTime)
84+ ToastManager . shared. showWarning ( HomeFeature . Strings. insufficientWaitTime)
8385 }
8486 }
8587}
@@ -96,7 +98,7 @@ extension HomeView {
9698 Image ( asset: . homeLogo)
9799 . resizable ( )
98100 . scaledToFill ( )
99- . frame ( width: geometry. size. width, height: LayoutConstants . heroHeight , alignment: . top)
101+ . frame ( width: geometry. size. width, height: Layout . Hero . height , alignment: . top)
100102 . scaleEffect ( 1.06 , anchor: . top)
101103 . ignoresSafeArea ( edges: . top)
102104
@@ -115,25 +117,25 @@ extension HomeView {
115117 . frame ( maxWidth: . infinity, maxHeight: . infinity, alignment: . bottom)
116118 . padding ( . bottom, 28 )
117119 }
118- . frame ( width: geometry. size. width, height: LayoutConstants . heroHeight )
120+ . frame ( width: geometry. size. width, height: Layout . Hero . height )
119121 . background ( . clear)
120122 . clipShape (
121123 UnevenRoundedRectangle (
122124 cornerRadii: . init(
123- bottomLeading: LayoutConstants . heroCornerRadius ,
124- bottomTrailing: LayoutConstants . heroCornerRadius
125+ bottomLeading: Layout . Hero . cornerRadius ,
126+ bottomTrailing: Layout . Hero . cornerRadius
125127 )
126128 )
127129 )
128130
129131 if store. departureTimePickerVisible {
130132 departureTimePickerView ( )
131- . offset ( x: geometry. size. width + LayoutConstants . pickerOffset . horizontal, y: LayoutConstants . pickerOffset . vertical)
133+ . offset ( x: geometry. size. width + Layout . TimePicker . offset . horizontal, y: Layout . TimePicker . offset . vertical)
132134 . zIndex ( 2 )
133135 }
134136 }
135137 }
136- . frame ( height: LayoutConstants . heroHeight )
138+ . frame ( height: Layout . Hero . height )
137139 }
138140
139141 @ViewBuilder
@@ -182,7 +184,7 @@ extension HomeView {
182184 fileprivate func selectTrainTimeView( ) -> some View {
183185 HStack ( alignment: . top, spacing: 10 ) {
184186 timeCapsuleView (
185- title: Strings . currentTime,
187+ title: HomeFeature . Strings. currentTime,
186188 time: store. currentTime. formattedKoreanTime ( ) ,
187189 timeColor: . gray900,
188190 backgroundColor: . gray100
@@ -192,7 +194,7 @@ extension HomeView {
192194 store. send ( . view( . departureTimeButtonTapped) )
193195 } label: {
194196 timeCapsuleView (
195- title: Strings . departureTime,
197+ title: HomeFeature . Strings. departureTime,
196198 time: store. isDepartureTimeSet
197199 ? store. departureTime. formattedKoreanTime ( )
198200 : store. currentTime. formattedKoreanTime ( ) ,
@@ -210,7 +212,7 @@ extension HomeView {
210212 @ViewBuilder
211213 fileprivate func departureTimePickerView( ) -> some View {
212214 DatePicker (
213- Strings . departureTimeSelection,
215+ HomeFeature . Strings. departureTimeSelection,
214216 selection: $store. departureTime,
215217 in: store. currentTime... ,
216218 displayedComponents: [ . hourAndMinute]
@@ -221,11 +223,11 @@ extension HomeView {
221223 . onChange ( of: store. departureTime) { _, newValue in
222224 store. send ( . view( . departureTimeChanged( newValue) ) )
223225 }
224- . frame ( height: LayoutConstants . pickerHeight )
226+ . frame ( height: Layout . TimePicker . height )
225227 . clipped ( )
226- . frame ( width: LayoutConstants . pickerWidth )
228+ . frame ( width: Layout . TimePicker . width )
227229 . background ( . gray300)
228- . clipShape ( RoundedRectangle ( cornerRadius: LayoutConstants . cornerRadius) )
230+ . clipShape ( RoundedRectangle ( cornerRadius: Layout . TimePicker . cornerRadius) )
229231 }
230232
231233 @ViewBuilder
@@ -245,9 +247,9 @@ extension HomeView {
245247 . foregroundStyle ( timeColor)
246248 }
247249 . frame ( maxWidth: . infinity)
248- . frame ( height: LayoutConstants . timeCapsuleHeight )
250+ . frame ( height: Layout . TimeCapsule . height )
249251 . background ( backgroundColor)
250- . cornerRadius ( LayoutConstants . cornerRadius)
252+ . cornerRadius ( Layout . TimeCapsule . cornerRadius)
251253 }
252254
253255
@@ -262,7 +264,7 @@ extension HomeView {
262264 . foregroundStyle ( store. hasRemainingTimeResult ? . gray900 : . enableColor)
263265 . frame ( height: 69 )
264266
265- Text ( Strings . hours)
267+ Text ( HomeFeature . Strings. hours)
266268 . pretendardCustomFont ( textStyle: . caption)
267269 . foregroundStyle ( store. hasRemainingTimeResult ? . gray900 : . enableColor)
268270
@@ -285,7 +287,7 @@ extension HomeView {
285287 . foregroundStyle ( store. hasRemainingTimeResult ? . gray900 : . enableColor)
286288 . frame ( height: 69 )
287289
288- Text ( Strings . minutes)
290+ Text ( HomeFeature . Strings. minutes)
289291 . pretendardCustomFont ( textStyle: . caption)
290292 . foregroundStyle ( store. hasRemainingTimeResult ? . gray900 : . enableColor)
291293
@@ -296,7 +298,7 @@ extension HomeView {
296298 }
297299 . padding ( . vertical, 21 )
298300 . background (
299- RoundedRectangle ( cornerRadius: LayoutConstants . timeLeftCornerRadius )
301+ RoundedRectangle ( cornerRadius: Layout . TimeDisplay . cornerRadius )
300302 . fill ( . white)
301303 )
302304 . padding ( . horizontal, 24 )
@@ -308,7 +310,7 @@ extension HomeView {
308310 action: {
309311 store. send ( . view( . exploreNearbyButtonTapped) )
310312 } ,
311- title: Strings . exploreNearby,
313+ title: HomeFeature . Strings. exploreNearby,
312314 config: CustomButtonConfig . create ( ) ,
313315 isEnable: store. isExploreNearbyEnabled
314316 )
0 commit comments