SwiftUI NavigationView: remove sidebar separator

Viewed 509

I'm attempting to create a sidebar with Swift UI using a NavigaionView with the DoubleColumnNavigationViewStyle.

The sidebar works and can change tabs, but there's a gray line dividing the sidebar and its content:

enter image description here

I'd like to remove this separator because the sidebar will have a different background color. It also shows a drag cursor when hovering over it to change the sidebar width, but since it's a fixed-width sidebar, it doesn't do anything.

struct ContentView: View {

     @State private var selection: String? = "tab-1"

     var body: some View {
         NavigationView {
            VStack(spacing: 10) {
                NavigationLink(destination: TabOneView(), tag: "tab-1", selection: self.$selection) {
                    Text("One")
                }
                .frame(minWidth: 0, maxWidth: .infinity)

                NavigationLink(destination: TabTwoView(), tag: "tab-2", selection: self.$selection) {
                    Text("Two")
                }
                .frame(minWidth: 0, maxWidth: .infinity)

                Spacer()
            }
            .frame(maxHeight: .infinity)
            .frame(width: 80)
            .padding(.top, 40)
            .background(Color.white)
         }
        .navigationViewStyle(DoubleColumnNavigationViewStyle())
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .edgesIgnoringSafeArea(.all)
     }
}

How can I remove the divider?

0 Answers
Related