Better TabView support

This commit is contained in:
Thomas Ricouard 2024-07-09 16:52:52 +02:00
parent 30c5c36aa1
commit 24c7d5be61

View file

@ -59,18 +59,18 @@ struct AppView: View {
updateTab(with: newTab)
})) {
ForEach(availableTabs) { tab in
Tab(value: tab) {
tab.makeContentView(selectedTab: $selectedTab)
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .tabBar)
} label: {
if userPreferences.showiPhoneTabLabel {
tab.label
.environment(\.symbolVariants, tab == selectedTab ? .fill : .none)
} else {
Image(systemName: tab.iconName)
tab.makeContentView(selectedTab: $selectedTab)
.tabItem {
if userPreferences.showiPhoneTabLabel {
tab.label
.environment(\.symbolVariants, tab == selectedTab ? .fill : .none)
} else {
Image(systemName: tab.iconName)
}
}
}
.badge(badgeFor(tab: tab))
.tag(tab)
.badge(badgeFor(tab: tab))
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .tabBar)
}
}
.id(appAccountsManager.currentClient.id)