팔로잉 채널 전체 리스트 페이지 추가

This commit is contained in:
Yu Sung
2023-08-19 23:14:54 +09:00
parent 633e1bfd92
commit 78f80cebd5
9 changed files with 303 additions and 1 deletions

View File

@@ -0,0 +1,81 @@
//
// FollowCreatorView.swift
// SodaLive
//
// Created by klaus on 2023/08/19.
//
import SwiftUI
struct FollowCreatorView: View {
@StateObject var viewModel = FollowCreatorViewModel()
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
VStack(spacing: 0) {
DetailNavigationBar(title: "팔로잉 채널리스트")
HStack(spacing: 0) {
Text("")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
Text("\(viewModel.totalCount)")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "dd4500"))
Text("")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
Spacer()
}
.padding(.horizontal, 13.3)
ScrollView(.vertical, showsIndicators: false) {
VStack(spacing: 13.3) {
ForEach(0..<viewModel.creatorList.count, id: \.self) { index in
let creator = viewModel.creatorList[index]
FollowCreatorItemView(
creator: creator,
onClickFollow: { viewModel.creatorFollow(userId: $0) },
onClickUnFollow: { viewModel.creatorUnFollow(userId: $0) }
)
.padding(.horizontal, 20)
.onTapGesture {
AppState.shared
.setAppStep(step: .creatorDetail(userId: creator.creatorId))
}
.onAppear {
if index == viewModel.creatorList.count - 1 {
viewModel.getFollowedCreatorAllList()
}
}
}
}
.padding(.top, 13.3)
}
}
.onAppear {
viewModel.getFollowedCreatorAllList()
}
.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(hex: "9970ff"))
.foregroundColor(Color.white)
.multilineTextAlignment(.leading)
.cornerRadius(20)
.padding(.bottom, 66.7)
Spacer()
}
}
}
}
}