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