0

I'm having the exact same issue like the person who posted this question:

NavigationView doesn't display correctly when using TabView in SwiftUI

Am I doing anything wrong or is it just a SwiftUI bug that'll be fixed?

SmushyTaco
  • 1,421
  • 2
  • 16
  • 32
  • Possible duplicate of [NavigationView doesn't display correctly when using TabView in SwiftUI](https://stackoverflow.com/questions/57779387/navigationview-doesnt-display-correctly-when-using-tabview-in-swiftui) – haider_kazal Sep 18 '19 at 09:11

1 Answers1

6

Try adding .edgesIgnoringSafeArea(.top) to your TabView/ Top view

struct ContentView: View {
    @State private var selection = 0

    var body: some View {
        TabView(selection: $selection){
            HomePageView()
                .tabItem {
                    VStack {
                        Image(systemName: "house.fill")
                            .font(.title)
                    }
                }
                .tag(0)
            Text("Second View")
                .font(.title)
                .tabItem {
                    VStack {
                        Image(systemName: "bell.fill")
                            .font(.title)
                    }
                }
                .tag(1)
        }.edgesIgnoringSafeArea(.top)
    }
}
Amir.n3t
  • 2,859
  • 3
  • 21
  • 28