1

Basically, I am working on a project in which there is a navigation process, therefore, I have to implement navigationview with tabview. As app loads, initial screen appear(homeview) normal, but an issue arises as soon I switch between tab option, wide space appears. So can anyone guide me in it? I am adding code with this query.

Even I have tried to add navigationView on individual tabitem and on it wide space issue gets resolve but new issue appear that tabbar doesnot hides on navigationlink even i have implemented "uitabbar.appearance.ishidden = true" on respective view

'''
import SwiftUI

struct TabBarView: View {
    
    @State private var selection = 0
    
    var body: some View {
        
     NavigationView{
     TabView(selection: $selection) {
       
     HomeView()
         
                .tabItem {
                    Image("tab_icon1")
                        .resizable()
                        .frame(width: 10, height: 10, alignment: .center)
                }
                .tag(0)
            
//            Text("Search Tab")
            SettingView()
                .font(.system(size: 30, weight: .bold, design: .rounded))
                .tabItem {
                    Image("tab_icon2")
                        .resizable()
                        .frame(width: 30, height: 30, alignment: .center)
                }
                .tag(1)
           
            
            //tab_new
//            Text("New Tab")
            ActivityListView()
                .font(.system(size: 30, weight: .bold, design: .rounded))
                .tabItem {
                    Image("tab_new")
                        .resizable()
                        .frame(width: 30, height: 30, alignment: .center)
                }
                .tag(2)
            
            HomeView()
                .font(.system(size: 30, weight: .bold, design: .rounded))
                .tabItem {
                    Image("tab_icon3")
                        .resizable()
                        .frame(width: 30, height: 30, alignment: .center)
                }
                .tag(3)
         
            Text("Profile Tab")
                .font(.system(size: 30, weight: .bold, design: .rounded))
                .tabItem {
                    Image("tab_icon4")
                        .resizable()
                        .frame(width: 50, height: 50, alignment: .center)
                      
                }
                .tag(4)
            
        }
        .edgesIgnoringSafeArea(.top)
        .accentColor(Color("Pink"))
        .onAppear() {
            UITabBar.appearance().barTintColor = UIColor(named: "DarkGray")
            UITabBar.appearance().backgroundColor = UIColor(named: "DarkGray")
            
        }
//
        }
        
    }
        
}

'''
Shahrukh
  • 29
  • 3
  • did you try to add navigation inside tabview not outside it ?? – belal medhat May 11 '22 at 09:54
  • I have tried to add navigationView on individual tabitem and this resolve wide space issue but new issue appear that tabbar doesnot hides on navigationlink even i have to implemented "uitabbar.appearance.ishidden = true" on respective view – Shahrukh May 11 '22 at 10:12
  • try to add the two view modifier to every view like home and settings .navigationBarTitle("") .navigationBarHidden(true) – belal medhat May 11 '22 at 11:14
  • Same here. I tried a lot of solutions but got no luck. – Binh Ho Nov 11 '22 at 10:41

0 Answers0