목록2024/01 (2)
일왓록(日What錄)
⚠️발생 문제 회원가입에서 이메일 중복 검사, 비밀번호 유효성 검사, 비밀번호 재확인 검사, 닉네임 글자수 확인등의 조건을 확인하고 서버로 API요청을 하는 로직을 개발하던 중, 이메일 중복 검사를 확인했음에도 다시 확인하라는 메시지가 나오는 문제가 발생했다. 👀원인 inputEmail .filter({ !$0.isEmpty }) .debug() .drive(with: self) { owner, email in emailIsUsable.onNext(false) checkBtnActive.onNext(true) emailRequestable.onNext(owner.isValidEmail(email)) //유효성 검사를 통한 request가능 여부 } .disposed(by: disposeBag) 텍스트 필..
개발을 하다보면 유저의 핸드폰 번호를 입력받을 일이 잦다. 그러다 보면 사용자가 "-"를 쓰지 않아도 자동으로 "-"를 넣는 로직을 구현하고 싶을 때가 많은데 이 로직을 처리하는 방법중 하나에 대해서 작성해볼까 한다. ⚠️알고리즘 적으로 흠이 많은 로직일 수도 있습니다. 검색을 통해 오신 분들은 참고 정도로 봐주시면 감사하겠습니다. 💡아이디어 사용자의 입력 발생 사용자의 입력 또는 이미 입력되어 있는(텍스트 필드에 존재하는) 값중 숫자만 filter 현재까지 입력된 텍스트 필드에 있는 값 또한 "-" 가 포함되어 있으므로 이를 제거 하여 숫자만 뽑아내는 작업이 필요함 사용자가 현재까지 입력한 값에 대한 배열 / 적용할 패턴에 대한 배열 / 패턴이 적용된 최종 출력 배열 생성 패턴 배열 앞자리부터 숫자가 ..