I am new in SwiftUI and I try to build new project to learn quickly and I have a SwiftUI project, everything work very well, and when I click the any list items it is open other view, but bottom Tab bar still located in bottom. I want to hide bottom tab bar in there if I click any list items. Is it possible in SwiftUI?
Dark_MenuApp:
@main
struct DarkMenuApp: App {
@AppStorage("isDarkMode") private var isDarkMode = false
var body: some Scene {
WindowGroup {
TabView {
NavigationView {
DarkMenuView()
}.tabItem {
Image(systemName: "homekit")
Text("home")
}
Text("Liked")
.tabItem {
Image(systemName: "heart")
Text("Liked")
}
Text("Reels")
.tabItem {
Image(systemName: "video")
Text("Reels")
.environment(\.colorScheme, isDarkMode ? .dark : .light)
.preferredColorScheme(isDarkMode ? .dark : .light)
}
Text("Profile")
.tabItem {
Image(systemName: "person")
Text("Profile")
}
}.accentColor(.primary)
}
}
}
DarkMenuView:
struct DarkMenuView: View {
@AppStorage("isDarkMode") private var isDarkMode = false
var body: some View {
VStack{
Picker("Mode" , selection: $isDarkMode) {
Text("Light")
.tag(false)
Text("Dark")
.tag(true)
}.pickerStyle(SegmentedPickerStyle())
.padding()
List(0..<5, id: \.self) { num in
NavigationLink(destination: Text("\(num)")) {
Text("\(num)")
}
}
}.navigationTitle("Dark Menu")
}
}