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

[Feat] #372 - 온보딩 뷰 구현 #381

Merged
merged 15 commits into from
Mar 13, 2022
Merged

Conversation

L-j-h-c
Copy link
Member

@L-j-h-c L-j-h-c commented Mar 12, 2022

🔥Pull requests

온보딩 뷰 구현

⛳️ 작업한 브랜치

👷 작업한 내용

  • 온보딩 뷰 구현
  • 스플래시에서 isOnboarding이 nil인 경우 onboarding으로 감.
  • spark시작하기를 누른 경우 Isonboarding값을 set해줌

🚨참고 사항

  • 살짝 귀여운...MVVM 구조를 써봤습니다.

📸 스크린샷

기능 스크린샷
GIF

📟 관련 이슈

L-j-h-c added 12 commits March 12, 2022 11:28
셀 인덱스에 따라 버튼 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
일러스트 어셋 추가 및 적용
@L-j-h-c L-j-h-c added Feat 새로운 기능 구현 🧚‍♀️Devil『쥬노』 뀨의 의지 공식후계자입니다 아몰랑 labels Mar 12, 2022
@L-j-h-c L-j-h-c requested review from hyun99999 and yangsubinn March 12, 2022 08:17
@L-j-h-c L-j-h-c self-assigned this Mar 12, 2022
Copy link
Member

@yangsubinn yangsubinn left a 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 {
Copy link
Member

Choose a reason for hiding this comment

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

OnboardingCVCViewModel로 따로 사용하면서 느낀 viewModel의 장점이 있을까여?

Copy link
Member Author

Choose a reason for hiding this comment

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

음...저도 viewModel을 실전에서 처음 사용해보는거라 맞는 판단일지는 모르겠지만
일단 비즈니스 로직이 뷰모델로 분리되어 있으니 로직에 대한 수정사항이 있을 때 수정하기가 편했던 것 같아요.
이런 식으로 분리되어 있으니까 가독성이 좋아지는 것 같기도 하고? 익숙해지면 협업에서도 편하지 않을까 생각이 듭니다...

Copy link
Member

@hyun99999 hyun99999 left a comment

Choose a reason for hiding this comment

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

적절한 delegate 메서드를 사용해서 필요에 따라서 적용한것 같아서 아주 좋네요!

ViewModel 을 사용해본점은 멋지네요!! 이처럼 현업에서는 필요에 따라서 해당 플로우에 디자인 패턴을 적용한다고 해요!
준호선배는 가볍게 적용해봤다고하니 이렇게 현업하는 프로젝트에 적용해본것도 좋은 경험이 될거 같네요! 디자인패턴과 관련된 코드리뷰는 읽고 참고만 하고 넘어가도 될거 같네요! 대신 좀 더 공부해서 리펙 할 떄는 잘 적용해봐요 ㅋㅋㅋ 분명히 그 특징을 살려야 유효한 디자인 패턴도 존재하니까요!

Comment on lines 24 to 25
label.lineBreakMode = .byCharWrapping
label.numberOfLines = 0
Copy link
Member

Choose a reason for hiding this comment

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

유효한 속성이 아닌거 같아서 의도가 있을까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

아하 lineBreakMode도 설정해줘야 여러 줄이 나오는 줄 알았네요! 수정했습니당~

Comment on lines +35 to +46
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")
}
}
Copy link
Member

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 보다는 텍스트로 넘겨요!
이것도 참고하면 좋을거 같네요!

Copy link
Member Author

Choose a reason for hiding this comment

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

아하 그렇게 할 수도 있겠군요!! 조언 감사합니다~! 확실히 UI적인 부분을 분리해준다는 말이 그렇게 적용될 수도 있겠네요... 너무나 꿀팁!

Comment on lines 16 to 28
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
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

기본값이 true 면 좋을것같네요!

Copy link
Member Author

Choose a reason for hiding this comment

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

앗 제가 원래 의도는 True로 주려고 했던건데 예리하시네요...

Comment on lines +171 to +178
// 스크롤 애니메이션이 끝나면 호출되는 메서드 - 완전히 끝에 도달한 뒤에 버튼을 나타내기 위해서 사용
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
if (scrollView.contentOffset.x + 1) >= (scrollView.contentSize.width - scrollView.frame.size.width) {
sparkStartButtonHidden = false
} else {
sparkStartButtonHidden = true
}
}
Copy link
Member

Choose a reason for hiding this comment

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

👍💫

Comment on lines 183 to 185
extension OnboardingVC {
private func setUI() {
navigationController?.isNavigationBarHidden = true
Copy link
Member

Choose a reason for hiding this comment

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

네비게이션 컨트롤러는 만들어주는 곳이 없어보이는데 왜 히든하셨나용?

Copy link
Member Author

Choose a reason for hiding this comment

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

정말로 아무 생각 없이 넣은 코드...반성...

Comment on lines 128 to 135
@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)
}
Copy link
Member

Choose a reason for hiding this comment

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

present 메서드 completion 에 UserDefaults 메서드를 사용해줘도 좋을거 같네요!

Copy link
Member Author

Choose a reason for hiding this comment

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

넵 그러네요 수정했습니다!

Copy link
Member Author

@L-j-h-c L-j-h-c left a 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 {
Copy link
Member Author

Choose a reason for hiding this comment

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

음...저도 viewModel을 실전에서 처음 사용해보는거라 맞는 판단일지는 모르겠지만
일단 비즈니스 로직이 뷰모델로 분리되어 있으니 로직에 대한 수정사항이 있을 때 수정하기가 편했던 것 같아요.
이런 식으로 분리되어 있으니까 가독성이 좋아지는 것 같기도 하고? 익숙해지면 협업에서도 편하지 않을까 생각이 듭니다...

Comment on lines +35 to +46
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")
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

아하 그렇게 할 수도 있겠군요!! 조언 감사합니다~! 확실히 UI적인 부분을 분리해준다는 말이 그렇게 적용될 수도 있겠네요... 너무나 꿀팁!

Comment on lines 16 to 28
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
}
}
}
Copy link
Member Author

Choose a reason for hiding this comment

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

앗 제가 원래 의도는 True로 주려고 했던건데 예리하시네요...

Comment on lines 128 to 135
@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)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

넵 그러네요 수정했습니다!

Comment on lines 183 to 185
extension OnboardingVC {
private func setUI() {
navigationController?.isNavigationBarHidden = true
Copy link
Member Author

Choose a reason for hiding this comment

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

정말로 아무 생각 없이 넣은 코드...반성...

@L-j-h-c L-j-h-c merged commit 41286bc into TeamSparker:develop Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧚‍♀️Devil『쥬노』 뀨의 의지 공식후계자입니다 아몰랑 Feat 새로운 기능 구현
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] 온보딩 뷰 구현하기
3 participants