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

SecondViewController에서 registerButton의 enable이 로직에 영향을 주고 있나요?? #3

Open
snowedev opened this issue Feb 15, 2022 · 0 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@snowedev
Copy link
Member

snowedev commented Feb 15, 2022

실습에서 regex 관련 코드는 작성을 했습니다.
그래가지구 이메일, 비번, 닉네임, 정보동의까지 이루어졌다면 output.registerEnabled가 바인드 되면서 enable이 true로 바끼는데용.
형이 그때 보여줬던 동영상처럼 registerButton을 누를때 동작하는 액션이 코드상에 정의되어있지는 않은 것 같아서 그것까지 구현하는게 맞는건지 제가 못찾는건지 궁금합니당

    private func bind() {
        let input = SecondViewModel.Input(
            emailText: emailTextField.rx.text.orEmpty.asObservable(),
            passwordText: passwordTextField.rx.text.orEmpty.asObservable(),
            nickNameText: nicknameTextField.rx.text.orEmpty.asObservable(),
            registerBtnClicked: registerButton.rx.tap.asObservable(),
            privacyAgree: privacyAgreeSubject,
            promotionAgree: promotionAgreeSubject
        )
        
        let output = viewModel.transform(input: input)
        
        output.registerEnabled
            .bind(to: registerButton.rx.isEnabled)
            .disposed(by: disposeBag)
        
		output.registerResult
			.bind{[weak self] model in
				self?.statusLabel.text = """
			아이디 : \(model.email)
			비밀번호 : \(model.passWord)
			닉네임: \(model.nickName)
			"""
		}.disposed(by: disposeBag)
		
        privacyButton.rx.tap.map{ [weak self] in
            self?.privacyButton.isSelected.toggle()
            return self?.privacyButton.isSelected ?? false
        }
        .bind(to: privacyAgreeSubject)
        .disposed(by: disposeBag)
        
        promotionButton.rx.tap.map{ [weak self] in
            self?.promotionButton.isSelected.toggle()
            return self?.promotionButton.isSelected ?? false
        }
        .bind(to: promotionAgreeSubject)
        .disposed(by: disposeBag)
    }
@snowedev snowedev added the help wanted Extra attention is needed label Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants