-
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
1주차 기본,도전,심화과제 PR #6
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.
깔쌈하네용
// MARK: - objc function | ||
|
||
@objc func textFieldDidChange(_ sender: UITextField) { | ||
loginButton.isEnabled = emailTextField.hasText && passwordTextField.hasText |
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.
오 텍스트필드에 hasText라는 프로퍼티가 있나보네요 몰랐어요!
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.
haeText 사용하는게 더 깔끔해보이네요! 배우고 가요~!
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.
역시 ㅋㅋ 최고티비 ㅋㅋ ❤️
private func setUI() { | ||
setButtonUI() | ||
} | ||
|
||
private func setButtonUI() { | ||
nextButton.layer.cornerRadius = 15 | ||
} | ||
|
||
private func setTextField() { | ||
nameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | ||
} | ||
|
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.
하 함수나눈거 너무좋아여 ㅋ sarang
|
||
// MARK: - IBAction | ||
|
||
@IBAction func showPasswordButtonDidTap(_ sender: Any) { |
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.
DidTap이 이렇게 사람을 행복하게 하는 네이밍이엇나요?
|
||
private func setTextField() { | ||
[emailTextField, passwordTextField].forEach { | ||
$0?.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | ||
} | ||
} |
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.
오 delegate 대신 addTarget ~ 좋네요 깔끔하네요
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.
저는 항상 한 스토리보드에 모든 View를 만들었는데 협업 때는 여러 스토리보드로 나누는게 좋은가요?
그리고 코드 잘 보고 가요~!!~!!
@IBOutlet weak var welcomeLabel: UILabel! | ||
@IBOutlet weak var completeButton: UIButton! | ||
|
||
// MARK: - LifeCycle |
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.
MARK 주석은 따로 적는건가요?
한 번도 안 해봤는데 코드 보기에 좋네요!! 저도 해야겠어요~~~~~!!
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.
MARK 주석 썼을때 효과 .. 별 거 아니지만 오늘 퇴근하구.. 노션에 꼭 적어 올려드릴게요~!
private func setTextField() { | ||
nameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | ||
} | ||
|
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.
모든 함수가 간략하고 깔끔해요! 저도 조금 더 작게 나눠서 깔끔하게 만들어 볼게요!!
} | ||
|
||
private func removeTextField() { | ||
passwordTextField.text?.removeAll() |
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.
저는 "" 로 초기화 했는데 다음부터는 removeAll 메서드를 써야겠어요..!
completeVC.modalPresentationStyle = .fullScreen | ||
completeVC.userName = userName | ||
self.present(completeVC, animated: true) { | ||
self.navigationController?.popToRootViewController(animated: false) |
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.
생각못했는데 present하면서 먼저 popToRoot하는 방법도 좋은 것 같아요!!
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.
오홍 ~ 이런 방법도 있군요 !!
} | ||
} | ||
|
||
private func removeTextField() { |
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.
오 ,, removeTextField 생각도 못한 부분이네요 ,, 선배님 ,, 멋져요 ,,, 경민 선배 ,, 나만의 명예솝트관 ,,, 역시 ,, 매일 찾아와서 봐야겠다 ,,,
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.
코드가 엄청 깔끔해서 가독성이 미쳤네요 .. 많이 배워갑니다 ~~
|
||
@IBAction func nextButtonDidTap(_ sender: Any) { | ||
guard let passwordVC = self.storyboard?.instantiateViewController(withIdentifier: "JoinPasswordViewController") as? JoinPasswordViewController else { return } | ||
passwordVC.userName = nameTextField.text ?? "" |
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.
passwordVC.userName = nameTextField.text ?? "" | |
guard let name = nameTextField.text else { return } | |
passwordVC.userName = name |
이런식으로 guard let 구문을 활용해서 옵셔널 처리를 할 수 있을 것 같아요 !!
completeVC.modalPresentationStyle = .fullScreen | ||
completeVC.userName = userName | ||
self.present(completeVC, animated: true) { | ||
self.navigationController?.popToRootViewController(animated: false) |
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.
경민아 너무 잘해서 리뷰할게 없음 티비 ㅋㅋ
@IBAction func nextButtonDidTap(_ sender: Any) { | ||
guard let passwordVC = self.storyboard?.instantiateViewController(withIdentifier: "JoinPasswordViewController") as? JoinPasswordViewController else { return } |
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.
Identifier은 혹시 오타가 날수도 있으니 Constant 또는 뷰컨 swift 파일에 미리 적어두는 방법도 좋아!
나중에 Const.VC.JoinPasswordViewController 뭐 이런식으로 자동완성이 될 수 있도록!
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.
선배님 코드 잘보구 갑니다!
override func viewWillAppear(_ animated: Bool) { | ||
super.viewWillAppear(animated) | ||
removeTextField() | ||
} |
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.
앱 생명주기로 다시 돌아왓을 때 textfield지우는 법 배우고 갑니다! 덕분에 앱 생명주기도 찾아보고 왔어용:)
private func setTextField() { | ||
[emailTextField, passwordTextField].forEach { | ||
$0?.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | ||
} |
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.
딜리게이트 말고 이렇게 되는거 몰랐던...ㅎㅎ 잘 배워가여~
// MARK: - objc function | ||
|
||
@objc func textFieldDidChange(_ sender: UITextField) { | ||
loginButton.isEnabled = emailTextField.hasText && passwordTextField.hasText |
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.
haeText 사용하는게 더 깔끔해보이네요! 배우고 가요~!
nameTextField.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | ||
} | ||
|
||
private func removeTextField() { |
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.
진짜 함수를 쪼개서 보니까 코드 이해하기에 너무너무 좋아요!!!! ,,, 세상에,,
setButtonUI() | ||
} | ||
|
||
private func setButtonUI() { |
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.
버튼 ui도 이런식으로 함수로 쪼개는 방법 ,,, 알아갑니다 !!!💛
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.
1차 과제 수고하셨어유~~!!
private func setTextField() { | ||
[emailTextField, passwordTextField].forEach { | ||
$0?.addTarget(self, action: #selector(textFieldDidChange(_:)), for: .editingChanged) | ||
} |
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.
딜리게이트 말고 이렇게 되는거 몰랐던...ㅎㅎ 잘 배워가여~
🌱 작업한 내용
🌱 PR Point
안녕하세요 ,, 너무 별 거 없어서,, 실망하셧죠 ,, (꾸벅)
오토레이아웃을 안배워서 레이아웃을 정말.. 막 짰습니다!
Main 스토리보드는 후에 분명 탭바를 만들 것 같아서, 이번엔 안썼지만 밖에 따로 남겨뒀습니다!
한 스토리보드에 해도 충분히 커버될 1차 과제지만,, 협업에서는 나누니까! 그냥 일부러 나눠보았어요~!
코드에 대한 이해가 충분하지 않았어서 다른 스토리보드로의 화면전환도 어려워했던 저의 모습을 떠올리며
그 부분 코드를 좀 눈에 익숙하게 보여드리고자 나눠서 해보았습니다!
(그니까 철저히 처음 하는 YB 입장에서 짠 코드.. 라는 말~ ^__^)
좀 더 효율적일 부분이,, 있을 수 있겠지만,, 최대한 이지하게 갈겨보았답니다? 조언해주세요 뀨 ㅋㅋ
removeTextField는.. 제 사랑 뷰의 생명주기의 중요성 + (텍스트 남아있는게 거슬려서,,) 넣어보앗어요 ~!
Extension은,, 에셋 얼추 넣고 한번에 쏵 해보겠습니다~! 이번 과제 .. 에셋.. 안넣엇거든요 .. ^__^ .. 씨익
📸 스크린샷
📮 관련 이슈