Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Prevent a macOS bar from having a sidebar

By default the first list added to a view seems to be set to sidebar. Even if you don’t specifically call .listStyle(SidebarListStyle()).

Is there any way that the list you set on the view (even if it’s the first view) is not set to a sidebar? There is no indication on the Apple’s documentation, and anything I have tried to style the list is not working.

So instead of the list looking like this

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

it should look like

enter image description here

Thanks for the help.

EDIT:
Yes, code. Any simple code will do.

struct ContentView: View {
    var body: some View {
        List {
                NavigationLink(
                    destination: TextEView(),
                ) {
                    Text("One")
                }
        }
    }    
}

struct TextEView: View {
    @State private var fullText: String = "This is some editable text..."
    var body: some View {        
         TextEditor(text: $fullText)
    }
}

>Solution :

For your case try

    List {
            NavigationLink(
                destination: TextEView(),
            ) {
                Text("One")
            }
    }
    .listStyle(.plain) // << here !!
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading