콘텐츠 메인 - Api 분리
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// ContentMainCurationView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/11.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ContentMainCurationView: View {
|
||||
|
||||
@StateObject private var viewModel = ContentMainCurationViewModel()
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
if !viewModel.curationList.isEmpty {
|
||||
LazyVStack(spacing: 40) {
|
||||
ForEach(0..<viewModel.curationList.count, id: \.self) { index in
|
||||
ContentMainCurationItemView(item: viewModel.curationList[index])
|
||||
.padding(.horizontal, 13.3)
|
||||
.onAppear {
|
||||
if index == viewModel.curationList.count - 1 {
|
||||
viewModel.getCurationList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if viewModel.isLoading {
|
||||
ActivityIndicatorView()
|
||||
.frame(width: 100, height: 100)
|
||||
}
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.onAppear {
|
||||
viewModel.page = 1
|
||||
viewModel.isLast = false
|
||||
viewModel.getCurationList()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user