홈 - 하단 탭 추가
This commit is contained in:
73
SodaLive/Sources/Main/Home/HomeView.swift
Normal file
73
SodaLive/Sources/Main/Home/HomeView.swift
Normal file
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// HomeView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/09.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
import Firebase
|
||||
import Kingfisher
|
||||
|
||||
struct HomeView: View {
|
||||
|
||||
@StateObject var viewModel = HomeViewModel()
|
||||
@StateObject var appState = AppState.shared
|
||||
|
||||
private let liveView = LiveView()
|
||||
private let explorer = ExplorerView()
|
||||
private let messageView = MessageView()
|
||||
private let contentView = ContentMainView()
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { proxy in
|
||||
ZStack(alignment: .bottom) {
|
||||
VStack(spacing: 0) {
|
||||
ZStack {
|
||||
contentView
|
||||
.frame(width: viewModel.currentTab == .content ? proxy.size.width : 0)
|
||||
.opacity(viewModel.currentTab == .content ? 1.0 : 0.01)
|
||||
|
||||
liveView
|
||||
.frame(width: viewModel.currentTab == .live ? proxy.size.width : 0)
|
||||
.opacity(viewModel.currentTab == .live ? 1.0 : 0.01)
|
||||
|
||||
explorer
|
||||
.frame(width: viewModel.currentTab == .explorer ? proxy.size.width : 0)
|
||||
.opacity(viewModel.currentTab == .explorer ? 1.0 : 0.01)
|
||||
|
||||
messageView
|
||||
.frame(width: viewModel.currentTab == .message ? proxy.size.width : 0)
|
||||
.opacity(viewModel.currentTab == .message ? 1.0 : 0.01)
|
||||
|
||||
if viewModel.currentTab == .mypage {
|
||||
MyPageView()
|
||||
}
|
||||
}
|
||||
.padding(.bottom, appState.isShowPlayer ? 72 : 0)
|
||||
|
||||
Spacer()
|
||||
|
||||
BottomTabView(width: proxy.size.width, currentTab: $viewModel.currentTab)
|
||||
|
||||
if proxy.safeAreaInsets.bottom > 0 {
|
||||
Rectangle()
|
||||
.foregroundColor(Color(hex: "111111"))
|
||||
.frame(width: proxy.size.width, height: 15.3)
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
|
||||
}
|
||||
}
|
||||
.edgesIgnoringSafeArea(.bottom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct HomeView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
HomeView()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user