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

회원 가입 - 텍스트 입력에 대한 버튼의 반응형 프로그래밍 구현 #4

Merged
merged 4 commits into from
Nov 16, 2023

Conversation

andy-archive
Copy link
Owner

@andy-archive andy-archive commented Nov 15, 2023

Pull Request

🔗 관련 이슈 or PR

Issues

Pull Requests

✅ 체크리스트

  • merge 하려는 branch가 정확한지 확인
  • Reviewers, Assignees, Labels 설정
  • PR과 관련없는 commit이 없는지 확인
  • 코드 컨벤션 준수
  • 커밋 컨벤션 준수
  • 커밋 세분화
  • 코드를 검증하는 테스트 추가
  • 관련 기존 테스트 통과 여부 확인

✍️ 작업 내용

  • 이메일 입력 화면
    • 텍스트 입력에 따른 버튼의 반응형 구현
  • MVVM에 Input-Output 적용
  • RxSwift 적용

📱 구현 화면

반응형 이메일 입력 화면
반응형 이메일 입력 화면

🔥 특이 사항

블로그 정리

📚 참고 자료

@andy-archive andy-archive added the ⚡️ feature 새로운 기능 추가 label Nov 15, 2023
@andy-archive andy-archive self-assigned this Nov 15, 2023
Comment on lines 20 to 31
struct Output {
let isTextValid: BehaviorRelay<Bool>
let isTextValid: Observable<Bool>
}

private let disposeBag = DisposeBag()

func transform(input: Input) -> Output {

let isValid = BehaviorRelay(value: false)

input
let isValid = input
.text
.throttle(.seconds(1), scheduler: MainScheduler.instance)
.map { $0.contains("@") && $0.contains(".") && $0.count >= 6 && $0.count < 50 }
.bind(to: isValid)
.disposed(by: disposeBag)

return Output(isTextValid: isValid)
}
Copy link
Owner Author

Choose a reason for hiding this comment

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

BehaviorRelay를 이용해 다시 이를 bind 하는 것이, 단순한 텍스트 입력의 유효성 검사에서는 과분한 것 같아서 Observable로 리팩토링 하였습니다.

@andy-archive andy-archive changed the title 회원 가입 - 텍스트 입력에 대한 반응형 구현 회원 가입 - 텍스트 입력에 대한 버튼의 반응형 프로그래밍 구현 (#4) Nov 16, 2023
@andy-archive andy-archive merged commit 410b35b into develop Nov 16, 2023
1 check passed
@andy-archive andy-archive deleted the feature/text-to-button-reactive branch November 20, 2023 10:31
@andy-archive andy-archive changed the title 회원 가입 - 텍스트 입력에 대한 버튼의 반응형 프로그래밍 구현 (#4) 회원 가입 - 텍스트 입력에 대한 버튼의 반응형 프로그래밍 구현 Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚡️ feature 새로운 기능 추가
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant