Contents

init(_:destination:)

Creates a control, consisting of a URL and a title resource, used to navigate to a URL.

Declaration

@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, destination: URL)

Parameters

  • titleResource:

    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/")!)

See Also

Creating a link