-
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
마이페이지 스코어 리스트 & 홈 뷰 #86
마이페이지 스코어 리스트 & 홈 뷰 #86
Conversation
import Domain | ||
import Network | ||
|
||
struct KeymeTestsHomeFeature: Reducer { |
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.
디코에서 설명했듯이 이 feature는
- 테스트 시작, 테스트 결과 뷰 중 어떤 뷰를 보여줄지 분기처리하는 로직을 담당하게끔 계획함.
case .showTestStartView(let testData): | ||
state.view.dailyTestId = testData.testId | ||
state.testStartViewState = .init(nickname: state.view.nickname, testData: testData) |
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.
showTestStartView
로 testStartViewState
를 생성하면 View에 선언한 IfLetStore
에 의해서 KeymeTestsStartView
가 보여질 거야
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.
잠깐 설명한 적 있듯이 nickname
은 RootViewFeature
에서 사용자 정보를 업데이트 한 다음 '무조건' 전달해 줄거야. 원래 Optional로 처리하던 번거로움을 줄일 수 있었음.
- 만약 전달이 안 된다면 아예 이 화면에 진입할 수 없음.
.padding(.horizontal, 16) | ||
|
||
// 테스트 뷰 | ||
testView |
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.
오키 이건 제가 개발하면서 다시 볼게요 !
// Filler | ||
Spacer().frame(height: 75) | ||
|
||
welcomeText(nickname: viewStore.nickname) |
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.
TestStartView에 있던 걸 밖으로 뺐어. 결과 뷰에서도 재사용되는 것 같더라고!
} else: { | ||
Circle() | ||
.strokeBorder(.white.opacity(0.3), lineWidth: 1) | ||
.background(Circle().foregroundColor(.white.opacity(0.3))) |
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.
여기는 ProgressView 같은 거 띄우려고 했는데ㅋㅋㅋ 현재로선 아무 의미 없는 코드니까 삭제해도 ㄱㅊ
await send(.fetchDailyTests( | ||
TaskResult { | ||
try await self.keymeTestsClient.fetchDailyTests() | ||
} | ||
)) | ||
} |
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.
요 파트가 이제 HomeViewFeature
로 빠졌다고 보시면 됨
public enum Action { | ||
case logout | ||
case changeNickname(String) | ||
} |
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.
아직 쓸 일은 없는데 나중에 설정에서 로그아웃이나 닉변같이 전역적으로 영향을 미치는 액션에 대해서는 MainPageFeature
에서 처리하면 어떨까 싶었음. 이건 의견 주십셔ㅎㅎ
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.
이거 마이페이지 -> 세팅에서 받을 것 같음. 요쪽은 마이페이지라 제가 핸들링하겠읍니다.
var view: View | ||
var scoreListState: ScoreListFeature.State = .init() | ||
|
||
struct View: Equatable { |
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
로 감싼 State
나 Action
이 보이는데 이건 뷰에서 모든 액션이나 상태에 접근하지 못하게 하려고 했던게 의도임. private
처리가 사실상 불가능하다보니까 이런 식으로라도 접근성을 제한하려는 의도!
컨벤션으로 박을 생각은 없고 쓰시는 분께서 판단 하에 사용해주시면 좋겟읍니다.
} | ||
|
||
public var body: some View { | ||
WithViewStore(store, observe: { $0 }) { viewStore in | ||
WithViewStore(store, observe: \.view, send: MyPageFeature.Action.view) { viewStore in |
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
로 감사면 이런 식으로 쓸 수 잇찌
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.
서버에서 내려주는 형식이 좀 바뀌었더라고. 그래서 맞게 좀 바꿧읍니다.
지금 보니까 이름에 DTO 빠졌네..ㅎㅎ ㅈㅅ
|
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.
굳 고생하셨습니다 ~ 리뷰 늦어져서 죄송 🥺
.padding(.horizontal, 16) | ||
|
||
// 테스트 뷰 | ||
testView |
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.
오키 이건 제가 개발하면서 다시 볼게요 !
public enum Action { | ||
case logout | ||
case changeNickname(String) | ||
} |
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.
조아요 근데 해당 액션을 어디서 받는 거지 ?
마이페이지 스코어리스트 업데이트 & API 연결
홈 뷰 로직 업데이트 & API 연결
close [마이페이지] 스코어 리스트 #84