2021-06-09 20:51:23 +00:00
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct ContentView: View {
|
2021-06-14 18:05:02 +00:00
|
|
|
@StateObject private var state = AppState()
|
2021-06-11 21:11:59 +00:00
|
|
|
|
2021-06-14 18:05:02 +00:00
|
|
|
@State private var tabSelection: TabSelection = .subscriptions
|
2021-06-11 21:11:59 +00:00
|
|
|
|
2021-06-09 20:51:23 +00:00
|
|
|
var body: some View {
|
2021-06-10 22:50:10 +00:00
|
|
|
NavigationView {
|
2021-06-11 21:11:59 +00:00
|
|
|
TabView(selection: $tabSelection) {
|
2021-06-11 22:49:42 +00:00
|
|
|
SubscriptionsView(state: state, tabSelection: $tabSelection)
|
|
|
|
.tabItem { Text("Subscriptions") }
|
|
|
|
.tag(TabSelection.subscriptions)
|
|
|
|
|
2021-06-11 21:11:59 +00:00
|
|
|
PopularVideosView(state: state, tabSelection: $tabSelection)
|
2021-06-11 12:36:26 +00:00
|
|
|
.tabItem { Text("Popular") }
|
2021-06-11 21:11:59 +00:00
|
|
|
.tag(TabSelection.popular)
|
|
|
|
|
|
|
|
if state.showingChannel {
|
|
|
|
ChannelView(state: state, tabSelection: $tabSelection)
|
2021-06-11 22:49:42 +00:00
|
|
|
.tabItem { Text("\(state.channel) Channel") }
|
2021-06-11 21:11:59 +00:00
|
|
|
.tag(TabSelection.channel)
|
|
|
|
}
|
|
|
|
|
2021-06-11 21:40:35 +00:00
|
|
|
SearchView(state: state, tabSelection: $tabSelection)
|
2021-06-11 12:36:26 +00:00
|
|
|
.tabItem { Image(systemName: "magnifyingglass") }
|
2021-06-11 21:11:59 +00:00
|
|
|
.tag(TabSelection.search)
|
2021-06-10 22:50:10 +00:00
|
|
|
}
|
|
|
|
}
|
2021-06-09 20:51:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ContentView_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
ContentView()
|
|
|
|
}
|
|
|
|
}
|