77 lines
2.9 KiB
Swift
77 lines
2.9 KiB
Swift
//
|
|
// ContentMainIntroduceCreatorAllView.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 2/22/25.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ContentMainIntroduceCreatorAllView: View {
|
|
|
|
@StateObject var viewModel = ContentMainIntroduceCreatorAllViewModel()
|
|
|
|
var body: some View {
|
|
NavigationView {
|
|
BaseView(isLoading: $viewModel.isLoading) {
|
|
VStack(spacing: 13.3) {
|
|
DetailNavigationBar(title: "크리에이터 소개")
|
|
|
|
ScrollView(.vertical, showsIndicators: false) {
|
|
let horizontalPadding: CGFloat = 16
|
|
let gridSpacing: CGFloat = 16
|
|
let itemSize = (screenSize().width - (horizontalPadding * 2) - gridSpacing) / 2
|
|
|
|
LazyVGrid(
|
|
columns: Array(
|
|
repeating: GridItem(
|
|
.flexible(),
|
|
spacing: gridSpacing,
|
|
alignment: .topLeading
|
|
),
|
|
count: 2
|
|
),
|
|
alignment: .leading,
|
|
spacing: gridSpacing
|
|
) {
|
|
ForEach(0..<viewModel.introduceCreatorList.count, id: \.self) { index in
|
|
let item = viewModel.introduceCreatorList[index]
|
|
ContentNewAllItemView(width: itemSize, item: item)
|
|
.onAppear {
|
|
if index == viewModel.introduceCreatorList.count - 1 {
|
|
viewModel.getIntroduceCreatorList()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.padding(.horizontal, 13.3)
|
|
}
|
|
}
|
|
.onAppear {
|
|
viewModel.getIntroduceCreatorList()
|
|
}
|
|
}
|
|
.navigationBarHidden(true)
|
|
.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)
|
|
.font(.custom(Font.medium.rawValue, size: 12))
|
|
.background(Color.button)
|
|
.foregroundColor(Color.white)
|
|
.multilineTextAlignment(.leading)
|
|
.cornerRadius(20)
|
|
.padding(.bottom, 66.7)
|
|
Spacer()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
ContentMainIntroduceCreatorAllView()
|
|
}
|