mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Fix tab selection
This commit is contained in:
parent
7c4eee4a44
commit
8d89d7cc08
@ -12,11 +12,11 @@ struct VideosView: View {
|
||||
@State private var showingViewOptions = false
|
||||
|
||||
var body: some View {
|
||||
Section {
|
||||
if layout == .list {
|
||||
VideosListView(videos: videos)
|
||||
} else {
|
||||
VStack {
|
||||
if layout == .cells {
|
||||
VideosCellsView(videos: videos, columns: self.profile.cellsColumns)
|
||||
} else {
|
||||
VideosListView(videos: videos)
|
||||
}
|
||||
}
|
||||
.fullScreenCover(isPresented: $showingViewOptions) { ViewOptionsView() }
|
||||
|
@ -5,11 +5,9 @@ struct ContentView: View {
|
||||
@ObservedObject private var state = AppState()
|
||||
@ObservedObject private var profile = Profile()
|
||||
|
||||
@Default(.tabSelection) var tabSelection
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
TabView(selection: $tabSelection) {
|
||||
TabView(selection: tabSelection) {
|
||||
SubscriptionsView()
|
||||
.tabItem { Text("Subscriptions") }
|
||||
.tag(TabSelection.subscriptions)
|
||||
@ -40,6 +38,13 @@ struct ContentView: View {
|
||||
.environmentObject(state)
|
||||
.environmentObject(profile)
|
||||
}
|
||||
|
||||
var tabSelection: Binding<TabSelection> {
|
||||
Binding(
|
||||
get: { Defaults[.tabSelection] },
|
||||
set: { Defaults[.tabSelection] = $0 }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
struct ContentView_Previews: PreviewProvider {
|
||||
|
Loading…
Reference in New Issue
Block a user