refactor(navigation): 전역 경로 기반 단일 내비게이션 흐름으로 전환한다
This commit is contained in:
@@ -10,6 +10,7 @@ import SwiftUI
|
||||
struct SeriesMainByGenreView: View {
|
||||
|
||||
@StateObject var viewModel = SeriesMainByGenreViewModel()
|
||||
@State private var isInitialized = false
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
@@ -41,17 +42,16 @@ struct SeriesMainByGenreView: View {
|
||||
) {
|
||||
ForEach(viewModel.seriesList.indices, id: \.self) { index in
|
||||
let item = viewModel.seriesList[index]
|
||||
NavigationLink {
|
||||
SeriesDetailView(seriesId: item.seriesId)
|
||||
} label: {
|
||||
SeriesMainItemView(item: item, width: width, height: width * 227 / 160)
|
||||
.contentShape(Rectangle())
|
||||
.onAppear {
|
||||
if index == viewModel.seriesList.count - 1 {
|
||||
viewModel.getSeriesListByGenre()
|
||||
}
|
||||
SeriesMainItemView(item: item, width: width, height: width * 227 / 160)
|
||||
.contentShape(Rectangle())
|
||||
.onAppear {
|
||||
if index == viewModel.seriesList.count - 1 {
|
||||
viewModel.getSeriesListByGenre()
|
||||
}
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
AppState.shared.setAppStep(step: .seriesDetail(seriesId: item.seriesId))
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, horizontalPadding)
|
||||
@@ -73,7 +73,10 @@ struct SeriesMainByGenreView: View {
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
viewModel.getGenreList()
|
||||
if !isInitialized {
|
||||
viewModel.getGenreList()
|
||||
isInitialized = true
|
||||
}
|
||||
}
|
||||
|
||||
if viewModel.isLoading {
|
||||
|
||||
Reference in New Issue
Block a user