HomeiOS Developmentios - How you can cover TabBar whereas pushing subsequent display screen...

ios – How you can cover TabBar whereas pushing subsequent display screen in swiftUI


I wish to cover TabView backside TabBar if consumer navigate from subsequent display screen.

For instance I’ve TabView which have two tabItem as an example Dwelling and Account and residential display screen have notification choice if consumer click on notification I wish to navigate to notification display screen on the similar time I wish to cover TabView backside Tab additionally. Is Any strategy to obtain this. I am unable to discover any direct SwiftUI strategy to obtain this.

import SwiftUI

struct MyRootScreen: View {
    var physique: some View {
        TabView {
            NavigationView {
                HomeScreen()
            }
            .tabItem {
                Picture(systemName: "home")
            }
            
            Textual content("Account")
                .tabItem {
                    Picture(systemName: "particular person")
                }
        }
    }
}


struct HomeScreen: View {
    @State non-public var showNotification: Bool = false
    
    var physique: some View {
        VStack {
            Button {
                showNotification = true
            } label: {
                Textual content("Present Notification")
            }
        }
        .overlay {
            NavigationLink("", isActive: $showNotification) {
                Textual content("Notification Display screen")
            }
        }
    }
}

Notice: I wish to to realize this with out wrapping TabView into NavigationView.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments