Is there a way to hide the arrow to the right of the navigation link view that is automatically added?
I want to show an image grid using NavigationView -> List -> HStack -> NavigationLink_1 - NavigationLink_2
The NavigationLinks have arrows and it looks weird
opacity(0.0) to hide the arrow.
For the navigation link, instead of presenting the Text view, we change it to display an empty view. And, we attach the opacity modifier to NavigationLink and set its value to 0 . If you test the change in the preview, the disclosure indicator should disappear.
The . navigationBarBackButtonHidden(true) will hide the back button.
SwiftUI's NavigationLink has a second initializer that has an isActive parameter, allowing us to read or write whether the navigation link is currently active. In practical terms, this means we can programmatically trigger the activation of a navigation link by setting whatever state it's watching to true.
The way it worked for me:
List { ForEach(elements) { element in ZStack { CustomView(element: element) NavigationLink(destination: DestinationView()) { EmptyView() }.buttonStyle(PlainButtonStyle()) } } }
I got it done with this
NavigationLink(destination: DestinationView()) { EmptyView() } .frame(width: 0, height: 0) .hidden()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With