Skip to content

Conversation

@kim-seonwoo
Copy link
Member

👾 작업 내용

ViewModel의 너무나도 많은 책임을 덜어내고자 하였습니다.

OnboardingState enum

OnbardingState의 enum 파일을 만들어, viewModel의 텍스트 부분을 최대한 덜어냈습니다.

OnboardingUseCase

화면 전환 이외의 로직을 최대한 덜어내고자 하였습니다.

public protocol OnboardingUseCaseType {
    func postSignUpData(
        socialPlatform: String,
        userName: String,
        averageUseTime: String,
        problems: [String],
        period: Int,
        goalTime: Int
    ) -> AnyPublisher<Void, Error>
    func calculateGoalTime(hour: String, minute: String) -> Int
    func removeLastCharacterAndConvertToInt(from string: String) -> Int?
}

ViewModel State

   struct State {
        var onboardingState: OnboardingState
        var surveyButtonItems: [[SurveyButtonInfo]]
        var isNextAvailable: Bool
        var surveyState: Int
    }
  • 뷰 모델은 뷰에 다음과 같은 상태만 공유합니다.
  • SurveyButtonInfo관련 데이터 생성은 SurveyButtonInfo파일에 static 함수로 선언했습니다.

🚀 PR Point

  • ScrennViewModel관련 권한을 받아오던 로직은 주석 처리로 일단 스킵했습니다.

✅ CheckList

  • 오류 없이 빌드되는지 확인
  • 로그용 print문 제거
  • 불필요한 주석 제거
  • 코드 컨벤션 확인

🔗 Issue

Resolved #114

@kim-seonwoo kim-seonwoo added this to the 🍀 리펙토링 기간 milestone Nov 25, 2024
@kim-seonwoo kim-seonwoo self-assigned this Nov 25, 2024
@kim-seonwoo kim-seonwoo linked an issue Nov 25, 2024 that may be closed by this pull request
Copy link
Member

@Zoe0929 Zoe0929 left a comment

Choose a reason for hiding this comment

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

뷰모델이 간결해졌네요! 유즈케이스로 로직 분리한 점 좋습니다 ~ 👍
챌린지 생성 부분은 아직 분리 전인 것 맞지요 !?

@kim-seonwoo
Copy link
Member Author

뷰모델이 간결해졌네요! 유즈케이스로 로직 분리한 점 좋습니다 ~ 👍 챌린지 생성 부분은 아직 분리 전인 것 맞지요 !?

넵 챌린지 생성은 일단 온보딩에서 아예 제외 했습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Refactor] OnboardingFeature 리펙토링

3 participants