<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Link",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4LinkV"
  },
  "title" : "Link"
}
-->

# Link

A control for navigating to a URL.

```
@MainActor @preconcurrency struct Link<Label> where Label : View
```

## Overview

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.
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")!)
```

When a user taps or clicks a `Link`, the default behavior depends on the
contents of the URL. For example, SwiftUI opens a Universal Link in the
associated app if possible, or in the user’s default web browser if not.
Alternatively, you can override the default behavior by setting the
[`openURL`](/documentation/SwiftUI/EnvironmentValues/openURL) environment value with a custom
[`OpenURLAction`](/documentation/SwiftUI/OpenURLAction):

```
Link("Visit Our Site", destination: URL(string: "https://www.example.com")!)
    .environment(\.openURL, OpenURLAction { url in
        print("Open \(url)")
        return .handled
    })
```

As with other views, you can style links using standard view modifiers
depending on the view type of the link’s label. For example, a [`Text`](/documentation/SwiftUI/Text)
label could be modified with a custom [`font(_:)`](/documentation/SwiftUI/View/font(_:)) or
[`foregroundStyle(_:)`](/documentation/SwiftUI/View/foregroundStyle(_:)) to customize the appearance of the link in
your app’s UI.

## Topics

### Creating a link

[`init(_:destination:)`](/documentation/SwiftUI/Link/init(_:destination:))

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

[`init(destination:label:)`](/documentation/SwiftUI/Link/init(destination:label:))

Creates a control, consisting of a URL and a label, used to navigate
to the given URL.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)