Take over TabView's view but keep the tabs visible

33 Views Asked by At

When someone clicks on Notification, I want to show a view. However, I still want tabs visible at the bottom of the screen so they can go back to whatever tab they want.

I tried adding invisible tabItem for notification and profile buttons but to show their views, I have to show them in the tabView as well which I don't want.

VStack {
    HStack {
        Spacer()

        NavigationLink(destination: NotificationView()) {
            Image(systemName: "bell")
                .font(.title)
        }     
        
        NavigationLink(destination: SettingsView()) {
            Image(systemName: "person.circle")
                .font(.title)
        }

    }
    .padding(.horizontal, 20)
    .padding(.bottom, -1)
    
    
    TabView{
        TimelineView()
            .tabItem {
                Image(systemName: "house")
                Text("Home")
            }
        
        SearchView()
            .tabItem {
                Image(systemName: "magnifyingglass")
                Text("Search")
            }
        
        CreateView()
            .tabItem {
                Image(systemName: "plus.circle")
                Text("Create")
            }
        
        ReminderView()
            .tabItem {
                Image(systemName: "clock")
                Text("Reminder")
            }
        
        ConversationView()
            .tabItem {
                Image(systemName: "message")
                Text("Message")
            }
    }
    .accentColor(.blue)
    .padding(.bottom, -50)
}

enter image description here

0

There are 0 best solutions below