Skip to content
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

[REFACTOR] RxSwift 적용 (#11) #12

Merged
merged 27 commits into from
Jul 10, 2024
Merged

[REFACTOR] RxSwift 적용 (#11) #12

merged 27 commits into from
Jul 10, 2024

Conversation

seuriseuljjeok
Copy link
Collaborator

🔥Pull requests

⛳️ 작업한 브랜치

👷 작업한 내용

로그인, 닉네임 생성 RxSwift 적용

🚨 참고 사항

아직 메인에는 적용하지 못했어욤,,,

1. 아이디, 비밀번호, 닉네임 유효성 검사

  • 우선 아이디와 비밀번호 값을 텍스트 필드의 데이터를 관찰해서 비어있는지 확인하고 유효한지 아닌지를 Bool 값으로 받을 수 있도록 했다
    이를 값으로 유효하면 활성화 상태의 버튼을, 유효하지 않으면 비활성화 상태의 버튼으로 설정해주었다.
    로그인 버튼을 탭 할때는 유효값 여부에 따라 다음 화면으로 전환하도록 설정해주었다
  • 닉네임 또한 마찬가지로 텍스트 필드의 데이터를 관찰해서 변화가 있으면 텍스트 필드의 속성을 바꾸어주고, 변화가 끝났으면 다시 원래대로 변경해주었다

📟 관련 이슈

@seuriseuljjeok seuriseuljjeok requested a review from FpRaArNkK June 7, 2024 09:24
@seuriseuljjeok seuriseuljjeok self-assigned this Jun 7, 2024
Copy link

@Johyerin Johyerin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

과제하느라 고생 많으셨습니다아 앱잼 화이팅!!❤️❤️❤️

Copy link

@FpRaArNkK FpRaArNkK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7차 세미나 과제 진짜 고생많으셨습니다! 수많은 고민의 흔적이 엿보여 너무 멋있네요..!

Comment on lines +28 to +33
var isActivate: Bool = false {
didSet {
self.createNicknameView.warningLabel.isHidden = isActivate
self.createNicknameView.setSaveButton(isEnabled: isActivate)
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 부분도 Bool값을 가진 Reactive Stream으로 바꿔보면 더 좋을 것 같아요!

Comment on lines +95 to +101
createNicknameView.saveButton.rx.tap.subscribe(onNext: { _ in
if self.isActivate {
guard let nickname = self.createNicknameView.nicknameTextField.text else { return }
self.delegate?.saveUserNickname(nickname: nickname)
self.dismiss(animated: true)
}
}).disposed(by: disposeBag)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 부분도 Rx로 변경해서 ViewModel에 넣고, ViewModel 간 통신 로직을 짜주는 건 어떨까요??

Comment on lines +104 to +107
@objc
func didTapDimmedView(sender: UITapGestureRecognizer) {
self.dismiss(animated: true)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GestureRecognizer에 별도의 Objc 함수로 addTarget하는 것 보다는,
Rx에서 제공해주는 event 객체가 있어요!

let gesture = UITapGestureRecognizer()
gesture.rx.event
                .bind { [weak self] _ in
                    self?.dismiss(animated: true)
                }
                .disposed(by: disposeBag)

이런식으로 써줘도 좋을 것 같습니다!

@seuriseuljjeok seuriseuljjeok merged commit fbac103 into main Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants