Initializer

init(_:destination:)

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

Declaration 宣言

init<S>(_ title: S, destination: URL) where S : StringProtocol
Available when Label is Text. LabelTextである時に利用可能です。

Parameters パラメータ

title

A text string used as the title for describing the underlying destination URL.

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 displays the title string you provide as a link-styled view in your app:


func marketingLink(_ callToAction: String) -> Link {
    Link(callToAction,
        destination: URL(string: "https://www.example.com/")!)
}

See Also 参照

Creating a Link