-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] 온보딩 프로세스 구현완료 #156
[feat] 온보딩 프로세스 구현완료 #156
Changes from all commits
b7c2b6d
a6e7d00
cb2c7b6
6bc408d
32d50bd
31a3ed0
50b1dd5
8636c80
2b04452
e7c162b
95343c5
f30ef70
41f9598
121f927
3641c3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "ic_profilebasic.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
"filename" : "Mask group.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Splash.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "Splash 1.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "Splash 2.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// | ||
// NicknameView.swift | ||
// KkuMulKum | ||
// | ||
// Created by 이지훈 on 7/10/24. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
import Then | ||
|
||
class NicknameView: BaseView { | ||
|
||
let navigationBar = UIView().then { | ||
$0.backgroundColor = .white | ||
} | ||
|
||
let titleLabel = UILabel().then { | ||
$0.setText("프로필 설정", style: .body03, color: .black) | ||
} | ||
|
||
let separatorLine = UIView().then { | ||
$0.backgroundColor = .gray2 | ||
} | ||
Comment on lines
+15
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 시스템이 기본 제공하는 navigationItem을 사용하지 않으시고, 직접 view를 이용하여 구현하셨네요! 그리고 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 시스템이 기본 제공하는 navigationItem을 사용하지 않으시고, 직접 view를 이용하여 구현하셨네요! |
||
|
||
let subtitleLabel = UILabel().then { | ||
$0.setText("이름을 설정해 주세요", style: .head01, color: .gray8) | ||
} | ||
|
||
let nicknameTextField = CustomTextField(placeHolder: "이름을 입력해 주세요").then { | ||
$0.layer.cornerRadius = 8 | ||
$0.layer.borderWidth = 1 | ||
$0.layer.borderColor = UIColor.gray3.cgColor | ||
} | ||
|
||
let characterCountLabel = UILabel().then { | ||
$0.setText("0/5", style: .body06, color: .gray) | ||
$0.textAlignment = .right | ||
} | ||
|
||
let errorLabel = UILabel().then { | ||
$0.setText("한글, 영문, 숫자만을 사용해 총 5자 이내로 입력해주세요.", style: .caption02, color: .red) | ||
$0.isHidden = true | ||
} | ||
|
||
let nextButton = UIButton().then { | ||
$0.setTitle("다음", style: .body01, color: .white) | ||
$0.backgroundColor = .gray2 | ||
$0.setLayer(borderWidth: 0, borderColor: .clear, cornerRadius: 8) | ||
$0.isEnabled = false | ||
} | ||
|
||
override func setupView() { | ||
backgroundColor = .white | ||
|
||
[navigationBar, separatorLine, subtitleLabel, nicknameTextField, errorLabel, nextButton].forEach { addSubview($0) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 코딩 습관이 무섭네요 바로 코드 수정하겟습니다! |
||
navigationBar.addSubview(titleLabel) | ||
nicknameTextField.addSubview(characterCountLabel) | ||
} | ||
|
||
override func setupAutoLayout() { | ||
navigationBar.snp.makeConstraints { | ||
$0.top.leading.trailing.equalToSuperview() | ||
$0.height.equalTo(92) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👀 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Screen! |
||
} | ||
|
||
titleLabel.snp.makeConstraints { | ||
$0.centerX.equalTo(navigationBar.snp.centerX) | ||
$0.bottom.equalTo(navigationBar.snp.bottom).offset(-12) | ||
} | ||
|
||
separatorLine.snp.makeConstraints { | ||
$0.top.equalTo(navigationBar.snp.bottom) | ||
$0.leading.trailing.equalToSuperview() | ||
$0.height.equalTo(1) | ||
} | ||
|
||
subtitleLabel.snp.makeConstraints { | ||
$0.top.equalTo(separatorLine.snp.bottom).offset(24) | ||
$0.leading.trailing.equalToSuperview().inset(20) | ||
} | ||
|
||
nicknameTextField.snp.makeConstraints { | ||
$0.top.equalTo(subtitleLabel.snp.bottom).offset(22) | ||
$0.leading.trailing.equalToSuperview().inset(20) | ||
$0.height.equalTo(CustomTextField.defaultHeight) | ||
} | ||
|
||
characterCountLabel.snp.makeConstraints { | ||
$0.centerY.equalToSuperview() | ||
$0.trailing.equalToSuperview().inset(12) | ||
$0.width.equalTo(30) | ||
} | ||
|
||
errorLabel.snp.makeConstraints { | ||
$0.top.equalTo(nicknameTextField.snp.bottom).offset(8) | ||
$0.leading.trailing.equalToSuperview().inset(20) | ||
} | ||
|
||
nextButton.snp.makeConstraints { | ||
$0.leading.trailing.equalToSuperview().inset(20) | ||
$0.bottom.equalTo(safeAreaLayoutGuide).offset(-20) | ||
$0.height.equalTo(52) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// | ||
// NicknameViewController.swift | ||
// KkuMulKum | ||
// | ||
// Created by 이지훈 on 7/10/24. | ||
// | ||
|
||
import UIKit | ||
|
||
class NicknameViewController: BaseViewController { | ||
|
||
private let nicknameView = NicknameView() | ||
private let viewModel = NicknameViewModel() | ||
|
||
override func loadView() { | ||
view = nicknameView | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
setupBindings() | ||
setupActions() | ||
setupTextField() | ||
setupTapGesture() | ||
} | ||
|
||
private func setupBindings() { | ||
viewModel.nicknameState.bind { [weak self] state in | ||
switch state { | ||
case .empty: | ||
self?.nicknameView.nicknameTextField.layer.borderColor = UIColor.gray3.cgColor | ||
self?.nicknameView.errorLabel.isHidden = true | ||
case .valid: | ||
self?.nicknameView.nicknameTextField.layer.borderColor = UIColor.maincolor.cgColor | ||
self?.nicknameView.errorLabel.isHidden = true | ||
case .invalid: | ||
self?.nicknameView.nicknameTextField.layer.borderColor = UIColor.red.cgColor | ||
self?.nicknameView.errorLabel.isHidden = false | ||
} | ||
} | ||
|
||
viewModel.errorMessage.bind { [weak self] errorMessage in | ||
self?.nicknameView.errorLabel.text = errorMessage | ||
} | ||
|
||
viewModel.isNextButtonEnabled.bind { [weak self] isEnabled in | ||
self?.nicknameView.nextButton.isEnabled = isEnabled | ||
self?.nicknameView.nextButton.backgroundColor = isEnabled ? .maincolor : .gray2 | ||
} | ||
|
||
viewModel.characterCount.bind { [weak self] count in | ||
self?.nicknameView.characterCountLabel.text = count | ||
} | ||
} | ||
|
||
private func setupActions() { | ||
nicknameView.nicknameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | ||
nicknameView.nextButton.addTarget(self, action: #selector(nextButtonTapped), for: .touchUpInside) | ||
} | ||
Comment on lines
+56
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BaseViewController로부터 오버라이딩이 가능한 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 코딩 습관이 무섭네요 바로 코드 수정하겟습니다! |
||
|
||
private func setupTextField() { | ||
nicknameView.nicknameTextField.delegate = self | ||
nicknameView.nicknameTextField.returnKeyType = .done | ||
} | ||
|
||
private func setupTapGesture() { | ||
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard)) | ||
view.addGestureRecognizer(tapGesture) | ||
} | ||
|
||
@objc private func textFieldDidChange(_ textField: UITextField) { | ||
viewModel.validateNickname(textField.text ?? "") | ||
} | ||
|
||
@objc private func nextButtonTapped() { | ||
let profileSetupVC = ProfileSetupViewController(viewModel: ProfileSetupViewModel(nickname: viewModel.nickname.value)) | ||
profileSetupVC.modalPresentationStyle = .fullScreen | ||
present(profileSetupVC, animated: true, completion: nil) | ||
} | ||
|
||
@objc private func dismissKeyboard() { | ||
view.endEditing(true) | ||
nicknameView.nicknameTextField.layer.borderColor = UIColor.gray3.cgColor | ||
} | ||
} | ||
|
||
extension NicknameViewController: UITextFieldDelegate { | ||
func textFieldShouldReturn(_ textField: UITextField) -> Bool { | ||
textField.resignFirstResponder() | ||
nicknameView.nicknameTextField.layer.borderColor = UIColor.gray3.cgColor | ||
return true | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아 이부분 기획자 선생님들꼐 말을 해서 정확한 정보로 수정 예정입니다! 다음 스크럼때 말하겟습니다!