feat(home): 팔로잉 API 데이터를 연결한다

This commit is contained in:
Yu Sung
2026-07-01 00:24:37 +09:00
parent 29a54937ab
commit e15d114be3
2 changed files with 15 additions and 3 deletions

View File

@@ -3,6 +3,8 @@ import SwiftUI
struct MainHomeFollowingView: View { struct MainHomeFollowingView: View {
let onTapFollowingAll: () -> Void let onTapFollowingAll: () -> Void
@StateObject private var viewModel = MainHomeFollowingViewModel()
init(onTapFollowingAll: @escaping () -> Void = {}) { init(onTapFollowingAll: @escaping () -> Void = {}) {
self.onTapFollowingAll = onTapFollowingAll self.onTapFollowingAll = onTapFollowingAll
} }
@@ -10,12 +12,17 @@ struct MainHomeFollowingView: View {
var body: some View { var body: some View {
VStack(spacing: 0) { VStack(spacing: 0) {
MainHomeFollowingCreatorSection( MainHomeFollowingCreatorSection(
followingCreators: [], followingCreators: viewModel.response?.followingCreators ?? [],
onTapAll: onTapFollowingAll onTapAll: onTapFollowingAll
) )
MainPlaceholderTabView(title: "팔로잉") MainPlaceholderTabView(title: "팔로잉")
} }
.onAppear {
if viewModel.hasLoaded == false {
viewModel.fetchFollowing()
}
}
} }
} }

View File

@@ -209,7 +209,7 @@
### Phase 4: 팔로잉 탭 API 호출 연결과 데이터 상태 세팅 ### Phase 4: 팔로잉 탭 API 호출 연결과 데이터 상태 세팅
- [ ] **Task 4.1: 팔로잉 탭 진입 시 API 호출 연결** - [x] **Task 4.1: 팔로잉 탭 진입 시 API 호출 연결**
- 대상 파일: - 대상 파일:
- 수정: `SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingView.swift` - 수정: `SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingView.swift`
- 확인: `SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingViewModel.swift` - 확인: `SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingViewModel.swift`
@@ -223,7 +223,7 @@
- 실행 명령: `rg "StateObject private var viewModel = MainHomeFollowingViewModel|onAppear|hasLoaded|fetchFollowing|response\\?\\.followingCreators|isLoading|message|MainPlaceholderTabView" SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingView.swift SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingViewModel.swift` - 실행 명령: `rg "StateObject private var viewModel = MainHomeFollowingViewModel|onAppear|hasLoaded|fetchFollowing|response\\?\\.followingCreators|isLoading|message|MainPlaceholderTabView" SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingView.swift SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingViewModel.swift`
- 기대 결과: 팔로잉 탭 진입 시 ViewModel이 생성되고, 최초 진입에서 API 호출 후 응답 데이터가 기존 크리에이터 섹션에 전달되는 흐름이 확인된다. - 기대 결과: 팔로잉 탭 진입 시 ViewModel이 생성되고, 최초 진입에서 API 호출 후 응답 데이터가 기존 크리에이터 섹션에 전달되는 흐름이 확인된다.
- [ ] **Task 4.2: 팔로잉 API 호출 빌드 검증** - [x] **Task 4.2: 팔로잉 API 호출 빌드 검증**
- 대상 파일: - 대상 파일:
- 확인: `SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingView.swift` - 확인: `SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingView.swift`
- 확인: `SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingViewModel.swift` - 확인: `SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingViewModel.swift`
@@ -503,3 +503,8 @@
- 2026-06-30: `rg "onTapFollowingAll|followingList|FollowCreatorView" SodaLive/Sources/V2/Main/Home/MainHomeView.swift SodaLive/Sources/V2/Main/MainView.swift SodaLive/Sources/App/AppStep.swift SodaLive/Sources/ContentView.swift``전체` 버튼 라우팅 연결을 확인했다. - 2026-06-30: `rg "onTapFollowingAll|followingList|FollowCreatorView" SodaLive/Sources/V2/Main/Home/MainHomeView.swift SodaLive/Sources/V2/Main/MainView.swift SodaLive/Sources/App/AppStep.swift SodaLive/Sources/ContentView.swift``전체` 버튼 라우팅 연결을 확인했다.
- 2026-06-30: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build`를 재실행해 Phase 3 신규 Swift 파일 target 등록과 컴파일 성공을 확인했다. - 2026-06-30: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build`를 재실행해 Phase 3 신규 Swift 파일 target 등록과 컴파일 성공을 확인했다.
- 2026-07-01: 완료된 Phase 3은 유지하고, Phase 4를 팔로잉 탭 API 호출 연결과 데이터 상태 세팅 단계로 변경했다. 이후 섹션 UI 작업은 Phase 5부터 순차 진행하도록 Phase/Task 번호를 재정렬했다. - 2026-07-01: 완료된 Phase 3은 유지하고, Phase 4를 팔로잉 탭 API 호출 연결과 데이터 상태 세팅 단계로 변경했다. 이후 섹션 UI 작업은 Phase 5부터 순차 진행하도록 Phase/Task 번호를 재정렬했다.
- 2026-07-01: Phase 4 구현을 진행해 `MainHomeFollowingView``@StateObject private var viewModel = MainHomeFollowingViewModel()`를 추가하고, 최초 `onAppear`에서 `hasLoaded == false`일 때 `fetchFollowing()`을 호출하도록 연결했다.
- 2026-07-01: `MainHomeFollowingCreatorSection``followingCreators``viewModel.response?.followingCreators ?? []`로 연결해 API 성공 응답 데이터가 기존 크리에이터 섹션으로 전달되는 흐름을 확보했다.
- 2026-07-01: `rg "StateObject private var viewModel = MainHomeFollowingViewModel|onAppear|hasLoaded|fetchFollowing|response\?\.followingCreators|isLoading|message|MainPlaceholderTabView" SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingView.swift SodaLive/Sources/V2/Main/Home/Following/MainHomeFollowingViewModel.swift`로 Phase 4 정적 요구사항을 확인했다.
- 2026-07-01: `rg "onSelectFollowingTab|Binding\(|selectedTab = \.following|setAppStep\(step: \.login\)|TextTabBar" SodaLive/Sources/V2/Main/Home/MainHomeView.swift SodaLive/Sources/V2/Main/MainView.swift`로 비로그인 팔로잉 탭 guard 흐름이 유지됨을 확인했다.
- 2026-07-01: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug build`를 실행해 Phase 4 API 호출 연결 후 빌드 성공을 확인했다. 기존 AppIntents metadata extraction warning은 남아 있으나 컴파일 오류는 없었다.