-
Notifications
You must be signed in to change notification settings - Fork 6
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
[Feat] #372 - 온보딩 뷰 구현 #381
Conversation
OnboardingVC, CVC, ViewModel 생성
어셋 및 상수 추가
OnboardingCVC 레이아웃 구성
OnboardingVC UI 틀 잡기
guideLabel AttributedString 적용
셀 인덱스에 따라 버튼 isHidden 옵션 조절
페이지컨트롤 및 버튼 isHidden 옵션 세팅
스킵 버튼 기능 구현
sparkStartButton 셀 밖으로 뺴고 loginVC로 연결
…to feature/TeamSparker#372 # Conflicts: # Spark-iOS/Spark-iOS.xcodeproj/project.pbxproj # Spark-iOS/Spark-iOS/Resource/Constants/Storyboard.swift # Spark-iOS/Spark-iOS/Resource/Constants/ViewController.swift
일러스트 어셋 추가 및 적용
isOnboarding Userdefault 세팅
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
에 대한 viewModel
만 봤어서 cell
에 대한 viewModel
되게 신기하게 잘 봤습니당
|
||
import UIKit | ||
|
||
struct OnboardingCVCViewModel { |
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.
OnboardingCVCViewModel
로 따로 사용하면서 느낀 viewModel의 장점이 있을까여?
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.
음...저도 viewModel을 실전에서 처음 사용해보는거라 맞는 판단일지는 모르겠지만
일단 비즈니스 로직이 뷰모델로 분리되어 있으니 로직에 대한 수정사항이 있을 때 수정하기가 편했던 것 같아요.
이런 식으로 분리되어 있으니까 가독성이 좋아지는 것 같기도 하고? 익숙해지면 협업에서도 편하지 않을까 생각이 듭니다...
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 메서드를 사용해서 필요에 따라서 적용한것 같아서 아주 좋네요!
ViewModel 을 사용해본점은 멋지네요!! 이처럼 현업에서는 필요에 따라서 해당 플로우에 디자인 패턴을 적용한다고 해요!
준호선배는 가볍게 적용해봤다고하니 이렇게 현업하는 프로젝트에 적용해본것도 좋은 경험이 될거 같네요! 디자인패턴과 관련된 코드리뷰는 읽고 참고만 하고 넘어가도 될거 같네요! 대신 좀 더 공부해서 리펙 할 떄는 잘 적용해봐요 ㅋㅋㅋ 분명히 그 특징을 살려야 유효한 디자인 패턴도 존재하니까요!
label.lineBreakMode = .byCharWrapping | ||
label.numberOfLines = 0 |
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.
아하 lineBreakMode도 설정해줘야 여러 줄이 나오는 줄 알았네요! 수정했습니당~
var illustImage: UIImage? { | ||
switch index { | ||
case 0: | ||
return UIImage(named: "illustOnboarding1") | ||
case 1: | ||
return UIImage(named: "illustOnboarding2") | ||
case 2: | ||
return UIImage(named: "illustOnboarding3") | ||
default: | ||
return UIImage(named: "illustOnboarding4") | ||
} | ||
} |
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 model 의 경우는 뷰와 독립적인 면이 특징이고 이 특징은 간편하게 코드를 테스트할 수 있는 장점으로 이어진다구 해요! 그래서 저는 view model 을 설계할때면 uikit 을 import 하지 않고 이렇게 UIImage 보다는 텍스트로 넘겨요!
이것도 참고하면 좋을거 같네요!
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적인 부분을 분리해준다는 말이 그렇게 적용될 수도 있겠네요... 너무나 꿀팁!
private var sparkStartButtonHidden: Bool = false { | ||
didSet { | ||
if sparkStartButtonHidden == false { | ||
sparkStartButton.isHidden = false | ||
sparkStartButton.alpha = 0 | ||
UIView.animate(withDuration: 0.3) { | ||
self.sparkStartButton.alpha = 1 | ||
} | ||
} else { | ||
sparkStartButton.isHidden = 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.
기본값이 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.
앗 제가 원래 의도는 True로 주려고 했던건데 예리하시네요...
// 스크롤 애니메이션이 끝나면 호출되는 메서드 - 완전히 끝에 도달한 뒤에 버튼을 나타내기 위해서 사용 | ||
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) { | ||
if (scrollView.contentOffset.x + 1) >= (scrollView.contentSize.width - scrollView.frame.size.width) { | ||
sparkStartButtonHidden = false | ||
} else { | ||
sparkStartButtonHidden = 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.
👍💫
extension OnboardingVC { | ||
private func setUI() { | ||
navigationController?.isNavigationBarHidden = 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.
네비게이션 컨트롤러는 만들어주는 곳이 없어보이는데 왜 히든하셨나용?
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.
정말로 아무 생각 없이 넣은 코드...반성...
@objc | ||
private func presentToLogin() { | ||
guard let loginVC = UIStoryboard(name: Const.Storyboard.Name.login, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.login) as? LoginVC else { return } | ||
loginVC.modalPresentationStyle = .fullScreen | ||
loginVC.modalTransitionStyle = .crossDissolve | ||
UserDefaults.standard.set(false, forKey: Const.UserDefaultsKey.isOnboarding) | ||
self.present(loginVC, animated: true, completion: nil) | ||
} |
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 메서드 completion 에 UserDefaults 메서드를 사용해줘도 좋을거 같네요!
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.
ㄹl뷰 감사함니다 섬배들~
|
||
import UIKit | ||
|
||
struct OnboardingCVCViewModel { |
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.
음...저도 viewModel을 실전에서 처음 사용해보는거라 맞는 판단일지는 모르겠지만
일단 비즈니스 로직이 뷰모델로 분리되어 있으니 로직에 대한 수정사항이 있을 때 수정하기가 편했던 것 같아요.
이런 식으로 분리되어 있으니까 가독성이 좋아지는 것 같기도 하고? 익숙해지면 협업에서도 편하지 않을까 생각이 듭니다...
var illustImage: UIImage? { | ||
switch index { | ||
case 0: | ||
return UIImage(named: "illustOnboarding1") | ||
case 1: | ||
return UIImage(named: "illustOnboarding2") | ||
case 2: | ||
return UIImage(named: "illustOnboarding3") | ||
default: | ||
return UIImage(named: "illustOnboarding4") | ||
} | ||
} |
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적인 부분을 분리해준다는 말이 그렇게 적용될 수도 있겠네요... 너무나 꿀팁!
private var sparkStartButtonHidden: Bool = false { | ||
didSet { | ||
if sparkStartButtonHidden == false { | ||
sparkStartButton.isHidden = false | ||
sparkStartButton.alpha = 0 | ||
UIView.animate(withDuration: 0.3) { | ||
self.sparkStartButton.alpha = 1 | ||
} | ||
} else { | ||
sparkStartButton.isHidden = 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.
앗 제가 원래 의도는 True로 주려고 했던건데 예리하시네요...
@objc | ||
private func presentToLogin() { | ||
guard let loginVC = UIStoryboard(name: Const.Storyboard.Name.login, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.login) as? LoginVC else { return } | ||
loginVC.modalPresentationStyle = .fullScreen | ||
loginVC.modalTransitionStyle = .crossDissolve | ||
UserDefaults.standard.set(false, forKey: Const.UserDefaultsKey.isOnboarding) | ||
self.present(loginVC, animated: true, completion: nil) | ||
} |
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.
넵 그러네요 수정했습니다!
extension OnboardingVC { | ||
private func setUI() { | ||
navigationController?.isNavigationBarHidden = 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.
정말로 아무 생각 없이 넣은 코드...반성...
코드리뷰 반영
스플래시 조건처리를 잘못해서 올렸습니다...
🔥Pull requests
온보딩 뷰 구현
⛳️ 작업한 브랜치
👷 작업한 내용
🚨참고 사항
📸 스크린샷
📟 관련 이슈