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) updateTab(with: newTab)
})) { })) {
ForEach(availableTabs) { tab in ForEach(availableTabs) { tab in
Tab(value: tab) { tab.makeContentView(selectedTab: $selectedTab)
tab.makeContentView(selectedTab: $selectedTab) .tabItem {
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .tabBar) if userPreferences.showiPhoneTabLabel {
} label: { tab.label
if userPreferences.showiPhoneTabLabel { .environment(\.symbolVariants, tab == selectedTab ? .fill : .none)
tab.label } else {
.environment(\.symbolVariants, tab == selectedTab ? .fill : .none) Image(systemName: tab.iconName)
} else { }
Image(systemName: tab.iconName)
} }
} .tag(tab)
.badge(badgeFor(tab: tab)) .badge(badgeFor(tab: tab))
.toolbarBackground(theme.primaryBackgroundColor.opacity(0.30), for: .tabBar)
} }
} }
.id(appAccountsManager.currentClient.id) .id(appAccountsManager.currentClient.id)