<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/CustomizableToolbarContent/matchedTransitionSource(id:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI26CustomizableToolbarContentPAAE23matchedTransitionSource2id2inQrqd___AA9NamespaceV2IDVtSHRd__lF"
  },
  "title" : "matchedTransitionSource(id:in:)"
}
-->

# matchedTransitionSource(id:in:)

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

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

## 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 [`Namespace`](/documentation/SwiftUI/Namespace) variable
to a [`View`](/documentation/SwiftUI/View) or ``ToolbarContent` type and reading its value in
the type’s body method.

## 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))
                }
        }
    }
}
```

---

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)