I am trying to remove the chevron that appears on the right of the screen with a navigationLink that contains a view. This is my code below:
NavigationView {
List {
NavigationLink(destination: DynamicList()) {
ResultCard()
}
...
}
Other answers on Stack Overflow have recommended using something like the below:
NavigationLink(...)
.opacity(0)
However, this doesn’t work in my case since bringing the opacity down to 0 also removes the view that I am trying to display. This is also the case with ‘.hidden’. I’ve searched everywhere and the only somewhat working solution I could find was to alter the padding in order to ‘push’ the chevron off of the side, but this is a poor solution since the ‘ResultCard’ view will appear wonky/off-centre on different display sizes.
Perhaps it isn’t possible to remove the chevron – and if this is the case, is there any other way I can allow the user to tap the ‘ResultCard’ view and be taken to a new page, that isn’t through a navigation link?
I’m banging my head on the wall so any ideas are very much appreciated.
4
Answers
You can use an
.overlay
on your label view with aNavigationLink
with anEmptyView()
set as its label:Update:
Another solution, which seems to work with other types of Views besides Text:
Here are two alternative variations using .background():
The Update solution from jnpdx almost worked for me, but it messed up the animation to the next view. Here’s what worked for me (is actually simpler than jnpdx’s answer):
This worked for me, building on @wristbands’s solution and targeting iOS 16 using Xcode 14.1: