SwiftUI's Link is a control for navigating to a URL. Create a link by providing a destination URL and a title. The title tells the user the purpose of the link, and can be a string, a title key that produces a localized string, or a view that acts as a label.
Example Usage
The example below creates a link to example.com and displays the title string as a link-styled view:
Link("View Our Terms of Service",
destination: URL(string: "https://www.example.com/TOS.html")!)
Alternatively, you can override the default behavior by setting the openURL environment value with a custom OpenURLAction:
Link("Visit Our Site", destination: URL(string: "https://www.example.com")!)
.environment(\.openURL, OpenURLAction { url in
print("Open \(url)")
return .handled
})
Click here to see the full documentation.