-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
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.
7차 세미나 과제 진짜 고생많으셨습니다! 수많은 고민의 흔적이 엿보여 너무 멋있네요..!
var isActivate: Bool = false { | ||
didSet { | ||
self.createNicknameView.warningLabel.isHidden = isActivate | ||
self.createNicknameView.setSaveButton(isEnabled: isActivate) | ||
} | ||
} |
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.
해당 부분도 Bool값을 가진 Reactive Stream으로 바꿔보면 더 좋을 것 같아요!
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) |
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.
해당 부분도 Rx로 변경해서 ViewModel에 넣고, ViewModel 간 통신 로직을 짜주는 건 어떨까요??
@objc | ||
func didTapDimmedView(sender: UITapGestureRecognizer) { | ||
self.dismiss(animated: 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.
GestureRecognizer에 별도의 Objc 함수로 addTarget하는 것 보다는,
Rx에서 제공해주는 event 객체가 있어요!
let gesture = UITapGestureRecognizer()
gesture.rx.event
.bind { [weak self] _ in
self?.dismiss(animated: true)
}
.disposed(by: disposeBag)
이런식으로 써줘도 좋을 것 같습니다!
🔥Pull requests
⛳️ 작업한 브랜치
👷 작업한 내용
로그인, 닉네임 생성 RxSwift 적용
🚨 참고 사항
아직 메인에는 적용하지 못했어욤,,,
1. 아이디, 비밀번호, 닉네임 유효성 검사
이를 값으로 유효하면 활성화 상태의 버튼을, 유효하지 않으면 비활성화 상태의 버튼으로 설정해주었다.
로그인 버튼을 탭 할때는 유효값 여부에 따라 다음 화면으로 전환하도록 설정해주었다
📟 관련 이슈