Fix tab selection

This commit is contained in:
Arkadiusz Fal
2021-06-27 01:50:32 +02:00
parent 7c4eee4a44
commit 8d89d7cc08
2 changed files with 12 additions and 7 deletions

View File

@@ -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 {