If you are looking to remove the arrow which appear on the right of the list row on swiftui, you can use the following trick.
import SwiftUI
struct Item {
var name : String
}
struct MyCustomView: View{
var item : Item
var body: some View {
Text(item.name)
}
}
struct DestinationView : View {
var body: some View {
Text("Destination")
}
}
struct ContentView: View {
var items: [Item] = [
Item(name: "Pippo"),
Item(name: "Pluto"),
]
var body: some View {
NavigationView {
List{
ForEach(items, id: \.name) {
item in
ZStack {
MyCustomView(item: item)
NavigationLink(destination: DestinationView()) {
}.buttonStyle(PlainButtonStyle()).frame(width:0).opacity(0)
}
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Basically what is needed for this trick to work is to wrap your list item content inside a ZStack, then you add as first element of the ZStack your view code, then after that you can add the NavigationLink with an empty view which basically does the trick to enable the linking to destination detail view while avoiding to show the disclosure arrow indicator
Thanks, dude! This worked perfectly.
I was wrong. It is working perfectly in preview, but not in Simulator.
i have updated the example should be working now