---
title: "matchedTransitionSource(id:in:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/toolbarcontent/matchedtransitionsource(id:in:)"
---

# matchedTransitionSource(id:in:)

Identifies this toolbar content as the source of a navigation transition, such as a zoom transition.

## Declaration

```swift
nonisolated func matchedTransitionSource(id: some Hashable, in namespace: Namespace.ID) -> some ToolbarContent

```

## Parameters

- `id`: The identifier, often derived from the identifier of the data being displayed by the toolbar content.
- `namespace`: The namespace in which defines the id. New namespaces are created by adding an doc://com.apple.SwiftUI/documentation/SwiftUI/Namespace variable to a doc://com.apple.SwiftUI/documentation/SwiftUI/View or ``ToolbarContent` type and reading its value in the type’s body method.

## Discussion

Discussion Use this modifier in conjunction with View.navigationTransition(_:) to provide a source for the transition effect: struct ContentView: View {     @State private var isPresented = false     @Namespace private var namespace

var body: some View {         NavigationStack {             DetailView()                 .toolbar {                     ToolbarItem(placement: .topBarTrailing) {                         Button("Show Sheet", systemImage: "globe") {                             isPresented = true                         }                     }                     .matchedTransitionSource(                         id: "world", in: namespace)                 }                 .sheet(isPresented: $isPresented) {                     SheetView()                         .navigationTransition(                             .zoom(sourceID: "world", in: namespace))                 }         }     } }
