init(_:destination:)
Creates a control, consisting of a URL and a title key, used to navigate to a URL.
Declaration
nonisolated init(_ titleKey: LocalizedStringKey, destination: URL)Parameters
- titleKey:
The key for the localized title that describes the purpose of this link.
- destination:
The URL for the link.
Discussion
Use Link to create a control that your app uses to navigate to a URL that you provide. The example below creates a link to example.com and uses Visit Example Co as the title key to generate a link-styled view in your app:
Link("Visit Example Co",
destination: URL(string: "https://www.example.com/")!)