Files
sodalive-ios/SodaLive/Sources/Content/Series/Main/ByGenre/SeriesMainByGenreView.swift
Yu Sung 280e424385 커스텀 폰트 pretendard-medium, gmarket-medium를 사용하고 있던 것을 appFont 모디
파이어를 사용하여 한국어는 pretendard, 그 외에는 시스템 폰트를 사용하도록 수정
2026-01-23 03:09:20 +09:00

89 lines
3.2 KiB
Swift

//
// SeriesMainByGenreView.swift
// SodaLive
//
// Created by klaus on 11/14/25.
//
import SwiftUI
struct SeriesMainByGenreView: View {
@StateObject var viewModel = SeriesMainByGenreViewModel()
var body: some View {
ZStack {
VStack(spacing: 16) {
if !viewModel.genreList.isEmpty {
SeriesMainGenreView(
genreList: viewModel.genreList,
selectGenre: viewModel.onTapGenre,
selectedGenre: $viewModel.selectedGenre
)
}
ScrollView(.vertical, showsIndicators: false) {
let horizontalPadding: CGFloat = 24
let gridSpacing: CGFloat = 16
let width = (screenSize().width - (horizontalPadding * 2) - gridSpacing) / 2
LazyVGrid(
columns: Array(
repeating: GridItem(
.flexible(),
spacing: gridSpacing,
alignment: .topLeading
),
count: 2
),
alignment: .leading,
spacing: gridSpacing
) {
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()
}
}
}
}
}
.padding(.horizontal, horizontalPadding)
}
}
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) {
HStack {
Spacer()
Text(viewModel.errorMessage)
.padding(.vertical, 13.3)
.frame(width: screenSize().width - 66.7, alignment: .center)
.appFont(size: 12, weight: .medium)
.background(Color.button)
.foregroundColor(Color.white)
.multilineTextAlignment(.leading)
.cornerRadius(20)
.padding(.bottom, 66.7)
Spacer()
}
}
.onAppear {
viewModel.getGenreList()
}
if viewModel.isLoading {
LoadingView()
}
}
}
}
#Preview {
SeriesMainByGenreView()
}