
There's a .toolbar(.hidden, for: .tabBar) modifier.
Put this modifier in the destination View.
And then
In the ContentView
struct ContentView: View {
@State private var selection: Int = 0
var body: some View {
TabView(selection: $selection) {
HomeView()
.tabItem {
Image(systemName: "house")
}
.toolbarBackground(.visible, for: .tabBar)
.tag(0)
NavigationStack {
ForumView()
}
.tabItem {
Image(systemName: "text.bubble")
}
.toolbarBackground(.visible, for: .tabBar)
.tag(1)
NavigationStack {
ProjectsView()
}
.tabItem {
Image(systemName: "folder.fill")
}
.toolbarBackground(.visible, for: .tabBar)
.tag(2)
LoginRootView()
.tabItem {
Image(systemName: "person.crop.circle")
}
.toolbarBackground(.visible, for: .tabBar)
.tag(3)
}
.tint(Color.orange)
.animation(.spring(response: 0.3, dampingFraction: 0.6), value: selection)
.toolbar(.visible, for: .tabBar)
}
.animation(.spring(response: 0.3, dampingFraction: 0.6), value: selection)
Put this animation in the TabView's selection property
There's a
.toolbar(.hidden, for: .tabBar)modifier.Put this modifier in the destination View.
And then
In the ContentView
.animation(.spring(response: 0.3, dampingFraction: 0.6), value: selection)Put this animation in the TabView's selection property