swiftswiftui

SwiftUI: How to remove caret right in NavigationLink which is inside a List


I have a issue about NavigationLink in SwiftUI. I have a List restaurant and have NavigationLink in it. I tried to remove the caret right in right of NavigationLink section but not success

I tried to remove caret using buttonStyle but is's not work.

List(vm.restaurants) { (restaurant: Restaurant) in
   NavigationLink(destination: ResDetailView(restaurant: restaurant)) {
        RestaurantRow(life: life)
   }.buttonStyle(PlainButtonStyle())
}

enter image description here


Solution

  • you can do it like this:

    var body: some View {
            NavigationView() {
                List(menu, id: \.self) { section in
    
                    VStack{
                        Text(section.name)
                        NavigationLink(destination: Dest()) {
                            EmptyView()
                        }
                    }
                }
            }