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