<!--
{
  "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/View/navigationDestination(for:destination:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE21navigationDestination3for11destinationQrqd__m_qd_0_qd__ctSHRd__AaBRd_0_r0_lF"
  },
  "title" : "navigationDestination(for:destination:)"
}
-->

# navigationDestination(for:destination:)

Associates a destination view with a presented data type for use within
a navigation stack.

```
nonisolated func navigationDestination<D, C>(for data: D.Type, @ContentBuilder destination: @escaping (D) -> C) -> some View where D : Hashable, C : View
```

## Parameters

`data`

The type of data that this destination matches.

`destination`

A content builder that defines a view to display
when the stack’s navigation state contains a value of
type `data`. The closure takes one argument, which is the value
of the data to present.

## Discussion

Add this view modifier to a view inside a [`NavigationStack`](/documentation/SwiftUI/NavigationStack) to
describe the view that the stack displays when presenting
a particular kind of data. Use a [`NavigationLink`](/documentation/SwiftUI/NavigationLink) to present
the data. For example, you can present a `ColorDetail` view for
each presentation of a [`Color`](/documentation/SwiftUI/Color) instance:

```
NavigationStack {
    List {
        NavigationLink("Mint", value: Color.mint)
        NavigationLink("Pink", value: Color.pink)
        NavigationLink("Teal", value: Color.teal)
    }
    .navigationDestination(for: Color.self) { color in
        ColorDetail(color: color)
    }
    .navigationTitle("Colors")
}
```

You can add more than one navigation destination modifier to the stack
if it needs to present more than one kind of data.

Do not put a navigation destination modifier inside a “lazy” container,
like [`List`](/documentation/SwiftUI/List) or [`LazyVStack`](/documentation/SwiftUI/LazyVStack). These containers create child views
only when needed to render on screen. Add the navigation destination
modifier outside these containers so that the navigation stack can
always see the destination.

---

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)