@@ -73,6 +73,7 @@ final class GroupCreateViewController: BaseViewController {
73
73
let view = UIView ( )
74
74
view. backgroundColor = . grey800
75
75
view. layer. cornerRadius = 12
76
+ view. layer. borderWidth = 1
76
77
return view
77
78
} ( )
78
79
private let groupNameTextField = {
@@ -89,13 +90,21 @@ final class GroupCreateViewController: BaseViewController {
89
90
return textField
90
91
} ( )
91
92
private let groupNameCountLabel = {
93
+ let label = UILabel ( )
94
+ label. text = " 0 "
95
+ label. font = Fonts . smallS
96
+ return label
97
+ } ( )
98
+ private let groupNameMaxLengthLabel = {
92
99
let label = UILabel ( )
93
100
label. textColor = . grey300
94
101
label. font = Fonts . smallS
95
102
return label
96
103
} ( )
97
104
private var memberCountView = UIView ( )
98
105
private var todoLimitView = UIView ( )
106
+
107
+ // TODO: 추후 durationStackView, startAtStackView 공용 컴포넌트로 빼기
99
108
private func durationButton( duration: GroupChallengeDurations ) -> UIButton {
100
109
let button = UIButton ( )
101
110
button. backgroundColor = . grey800
@@ -190,9 +199,11 @@ final class GroupCreateViewController: BaseViewController {
190
199
191
200
override func viewDidLoad( ) {
192
201
super. viewDidLoad ( )
202
+ groupNameTextField. becomeFirstResponder ( )
193
203
setupKeyboardHandling ( )
194
204
}
195
205
206
+ // TODO: 추후 확인 필요 (하도 헤메다가 추가한 부분이라.. 무슨 의미를 갖는지 모르겠네요)
196
207
deinit {
197
208
NotificationCenter . default. removeObserver ( self )
198
209
}
@@ -213,7 +224,9 @@ final class GroupCreateViewController: BaseViewController {
213
224
214
225
completeButton. action = { @MainActor in
215
226
if self . viewModel. currentStep == . four {
216
- NavigationManager . shared. setNavigationController ( CompleteViewController ( type: . create) )
227
+ let completeViewController = CompleteViewController ( type: . create)
228
+ completeViewController. viewModel. joinCode = await self . viewModel. getJoinCode ( )
229
+ NavigationManager . shared. setNavigationController ( completeViewController)
217
230
} else {
218
231
await self . viewModel. completeAction ( )
219
232
self . updateStep ( )
@@ -223,7 +236,7 @@ final class GroupCreateViewController: BaseViewController {
223
236
groupName = componentTitleLabel ( componentTitle: " 그룹명 " )
224
237
groupNameTextField. delegate = self
225
238
groupNameTextField. addTarget ( self , action: #selector( didChangeGroupName) , for: . editingChanged)
226
- groupNameCountLabel . text = " 0 /\( viewModel. groupNameMaxLength) "
239
+ groupNameMaxLengthLabel . text = " / \( viewModel. groupNameMaxLength) "
227
240
memberCount = componentTitleLabel ( componentTitle: " 그룹 인원 " )
228
241
memberCountView = DogetherCountView ( changeCountAction: {
229
242
self . viewModel. updateMemberCount ( count: $0)
@@ -265,7 +278,7 @@ final class GroupCreateViewController: BaseViewController {
265
278
] . forEach { view. addSubview ( $0) }
266
279
267
280
[
268
- groupName, groupNameView, groupNameTextField, groupNameCountLabel,
281
+ groupName, groupNameView, groupNameTextField, groupNameCountLabel, groupNameMaxLengthLabel ,
269
282
memberCount, memberCountView
270
283
] . forEach { stepOneView. addSubview ( $0) }
271
284
@@ -325,6 +338,11 @@ final class GroupCreateViewController: BaseViewController {
325
338
$0. height. equalTo ( 25 )
326
339
}
327
340
groupNameCountLabel. snp. makeConstraints {
341
+ $0. centerY. equalTo ( groupNameView)
342
+ $0. right. equalTo ( groupNameMaxLengthLabel. snp. left)
343
+ $0. height. equalTo ( 18 )
344
+ }
345
+ groupNameMaxLengthLabel. snp. makeConstraints {
328
346
$0. centerY. equalTo ( groupNameView)
329
347
$0. right. equalTo ( groupNameView) . inset ( 16 )
330
348
$0. height. equalTo ( 18 )
@@ -466,9 +484,9 @@ final class GroupCreateViewController: BaseViewController {
466
484
}
467
485
468
486
Task { @MainActor in
469
- let ( groupName, countLabelText , buttonStatus) = await viewModel. updateGroupName ( groupName: groupNameTextField. text)
487
+ let ( groupName, buttonStatus) = await viewModel. updateGroupName ( groupName: groupNameTextField. text)
470
488
groupNameTextField. text = groupName
471
- groupNameCountLabel. text = countLabelText
489
+ groupNameCountLabel. text = String ( groupName . count )
472
490
completeButton. setButtonStatus ( status: buttonStatus)
473
491
}
474
492
}
@@ -545,17 +563,21 @@ extension GroupCreateViewController: UITextFieldDelegate {
545
563
546
564
@objc private func keyboardWillShow( _ notification: NSNotification ) {
547
565
guard let keyboardFrame = notification. userInfo ? [ UIResponder . keyboardFrameEndUserInfoKey] as? NSValue else { return }
566
+ groupNameView. layer. borderColor = UIColor . blue300. cgColor
567
+ groupNameCountLabel. textColor = . blue300
548
568
completeButton. snp. updateConstraints {
549
569
$0. bottom. equalToSuperview ( ) . inset ( keyboardFrame. cgRectValue. height + 16 )
550
570
}
551
- UIView . animate ( withDuration : 0.3 ) { self . view. layoutIfNeeded ( ) }
571
+ self . view. layoutIfNeeded ( )
552
572
}
553
573
554
574
@objc private func keyboardWillHide( _ notification: NSNotification ) {
575
+ groupNameView. layer. borderColor = UIColor . grey800. cgColor
576
+ groupNameCountLabel. textColor = . grey300
555
577
completeButton. snp. updateConstraints {
556
578
$0. bottom. equalToSuperview ( ) . inset ( 48 )
557
579
}
558
- UIView . animate ( withDuration : 0.3 ) { self . view. layoutIfNeeded ( ) }
580
+ self . view. layoutIfNeeded ( )
559
581
}
560
582
561
583
@objc private func dismissKeyboard( ) { view. endEditing ( true ) }
0 commit comments