feat: 메인 홈 - 라이브 중

- 터치 액션 추가
This commit is contained in:
Yu Sung
2025-07-14 19:52:16 +09:00
parent 4c3fa0fbb5
commit 87b43bd2c2
2 changed files with 25 additions and 3 deletions

View File

@@ -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)