refactor(navigation): 전역 경로 기반 단일 내비게이션 흐름으로 전환한다
This commit is contained in:
@@ -10,6 +10,7 @@ import SwiftUI
|
||||
struct SeriesMainHomeView: View {
|
||||
|
||||
@StateObject var viewModel = SeriesMainHomeViewModel()
|
||||
@State private var isInitialized = false
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
@@ -43,11 +44,10 @@ struct SeriesMainHomeView: View {
|
||||
LazyHStack(spacing: 16) {
|
||||
ForEach(0..<viewModel.completedSeriesList.count, id: \.self) {
|
||||
let item = viewModel.completedSeriesList[$0]
|
||||
NavigationLink {
|
||||
SeriesDetailView(seriesId: item.seriesId)
|
||||
} label: {
|
||||
SeriesMainItemView(item: item)
|
||||
}
|
||||
SeriesMainItemView(item: item)
|
||||
.onTapGesture {
|
||||
AppState.shared.setAppStep(step: .seriesDetail(seriesId: item.seriesId))
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
@@ -89,11 +89,10 @@ struct SeriesMainHomeView: View {
|
||||
) {
|
||||
ForEach(viewModel.recommendSeriesList.indices, id: \.self) {
|
||||
let item = viewModel.recommendSeriesList[$0]
|
||||
NavigationLink {
|
||||
SeriesDetailView(seriesId: item.seriesId)
|
||||
} label: {
|
||||
SeriesMainItemView(item: item, width: width, height: width * 227 / 160)
|
||||
}
|
||||
SeriesMainItemView(item: item, width: width, height: width * 227 / 160)
|
||||
.onTapGesture {
|
||||
AppState.shared.setAppStep(step: .seriesDetail(seriesId: item.seriesId))
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, horizontalPadding)
|
||||
@@ -117,7 +116,10 @@ struct SeriesMainHomeView: View {
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.fetchHome()
|
||||
if !isInitialized {
|
||||
viewModel.fetchHome()
|
||||
isInitialized = true
|
||||
}
|
||||
}
|
||||
|
||||
if viewModel.isLoading {
|
||||
|
||||
Reference in New Issue
Block a user