Reputation: 792
I have NavigationLink in List, and when I click to it, it highlights item. And also arrow shows at the right corner
NavigationLink(destination: ItemsListView()) {
Text("Show all (\(body.count))")
.font(.body)
.foregroundColor(Color.red)
}
How can hide the arrow in the right corner, and also disable highlighting?
Upvotes: 1
Views: 1933
Reputation: 111
.opacity(0.0) // just add this to the navigationLink
NavigationLink(destination: Text("\(element)")) {Text("\(element)")} .opacity(0.0)
Upvotes: -1
Reputation: 28539
You can set the selection style of the cell by doing the following.
List
UITableViewCell
selectionStyle
to be .none
Here is some example code:
struct ContentView: View {
init() {
let appearance = UITableViewCell.appearance()
appearance.selectionStyle = .none
// appearance.accessoryType = .none
}
var body: some View {
NavigationView {
List(0..<5, id: \.self) { element in
NavigationLink(destination: Text("\(element)")) {
Text("\(element)")
}
}
}
}
}
It should be possible to hide the accessoryType
of the cell by setting it to .none
as well (see the commented out code above) but it doesn't seem possible at this time.
Upvotes: 2