An external URL is not a "navigation destination". You should replace the NavigationLink
NavigationLink("Some Title", value: someElement)
with a Button
:
Button("Some Title") {
if let urlString = element.link?.externalUrlString, let url = URL(string: urlString) {
openURL(url)
}
}
If the NavigationLink
was originally in a List
, and you want to keep the trailing chevron, see SwiftUI List disclosure indicator without NavigationLink.
If you want to navigate to a SFSafariViewController
that shows that URL, see How do I use SFSafariViewController with SwiftUI?.