79523489

Date: 2025-03-20 16:11:20
Score: 1.5
Natty:
Report link

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?.

Reasons:
  • Blacklisted phrase (1): How do I
  • Probably link only (1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-2):
Posted by: Sweeper