0

i'm new with SwiftUI. My goal is to make List which listStyle is SidebarListStyle just exactly like this [first][1]

and here's my code

            List{
            MyProfile()
            Section(header:
                        Text("친구 102")
                        .font(.footnote)
                        .foregroundColor(.secondary)
            ){
                FriendsList()
            } // Section
        } // List
        .listStyle(SidebarListStyle())

But if i put this code inside NavigationView, listStyle changes without my intention like this [second][2]

and code

        NavigationView{
        List{
            MyProfile()
            Section(header:
                        Text("친구 102")
                        .font(.footnote)
                        .foregroundColor(.secondary)
            ){
                FriendsList()
            } // Section
        } // List
        .listStyle(SidebarListStyle())
    }

any help? [1]: https://i.stack.imgur.com/awX3H.png [2]: https://i.stack.imgur.com/vMBZn.png

sudoswift
  • 3
  • 1

1 Answers1

0

You can use StackNavigationViewStyle

NavigationView{
        List{
            MyProfile()
            Section(header:
                        Text("친구 102")
                        .font(.footnote)
                        .foregroundColor(.secondary)
            ){
                FriendsList()
            } // Section
        } // List
        .listStyle(SidebarListStyle())
    }
  .navigationViewStyle(StackNavigationViewStyle())
Ufuk Köşker
  • 1,288
  • 8
  • 29