<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/NavigationLink/init(value:label:)-4jswo",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI14NavigationLinkVAAs5NeverORs_rlE5value5labelACyxAEGqd__Sg_xyXEtcSHRd__lufc"
  },
  "title" : "init(value:label:)"
}
-->

# init(value:label:)

Creates a navigation link that presents the view corresponding to a
value.

```
nonisolated init<P>(value: P?, @ContentBuilder label: () -> Label) where P : Hashable
```

## Parameters

`value`

An optional value to present.
When the user selects the link, SwiftUI stores a copy of the value.
Pass a `nil` value to disable the link.

`label`

A label that describes the view that this link presents.

## Discussion

When someone activates the navigation link that this initializer
creates, SwiftUI looks for a nearby
`View/navigationDestination(for:destination:)` view modifier
with a `data` input parameter that matches the type of this
initializer’s `value` input, with one of the following outcomes:

- If SwiftUI finds a matching modifier within the view hierarchy of an
  enclosing `NavigationStack`, it pushes the modifier’s corresponding
  `destination` view onto the stack.
- If SwiftUI finds a matching modifier in the view hierarchy of a stack
  that’s in a later column of a `NavigationSplitView`, it puts the
  modifier’s destination view as the first and only item onto the stack
  while preserving the stack’s root view.
- If there’s no matching modifier, but the link appears in a `List`
  with selection inside a leading column of a navigation split view,
  the link updates the selection, which might affect the appearance of
  a trailing view. For an example of this, see `NavigationLink`.
- In other cases, the link doesn’t do anything.

If you want to be able to serialize a `NavigationPath` that includes
this link, use a `value` that conforms to the
<doc://com.apple.documentation/documentation/Swift/Codable> protocol.

---

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)