feat: 메인 홈 - 라이브 중
- 터치 액션 추가
This commit is contained in:
@@ -9,6 +9,8 @@ import SwiftUI
|
||||
|
||||
struct HomeTabView: View {
|
||||
@StateObject var viewModel = HomeTabViewModel()
|
||||
@StateObject var liveViewModel = LiveViewModel()
|
||||
|
||||
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
|
||||
@AppStorage("role") private var role: String = UserDefaults.string(forKey: UserDefaultsKey.role)
|
||||
|
||||
@@ -50,8 +52,25 @@ struct HomeTabView: View {
|
||||
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 16) {
|
||||
ForEach(0..<viewModel.liveList.count, id: \.self) {
|
||||
HomeLiveItemView(item: viewModel.liveList[$0])
|
||||
ForEach(0..<viewModel.liveList.count, id: \.self) { index in
|
||||
HomeLiveItemView(item: viewModel.liveList[index]) { roomId in
|
||||
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||
AppState.shared.setAppStep(
|
||||
step: .liveDetail(
|
||||
roomId: roomId,
|
||||
onClickParticipant: {
|
||||
AppState.shared.isShowPlayer = false
|
||||
liveViewModel.enterLiveRoom(roomId: roomId)
|
||||
},
|
||||
onClickReservation: {},
|
||||
onClickStart: {},
|
||||
onClickCancel: {}
|
||||
)
|
||||
)
|
||||
} else {
|
||||
AppState.shared.setAppStep(step: .login)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 24)
|
||||
|
||||
Reference in New Issue
Block a user