<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/TabContent/customizationID(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10TabContentPAAE15customizationIDyQrSSF"
  },
  "title" : "customizationID(_:)"
}
-->

# customizationID(_:)

Sets the identifier for a tab to persist its state.

```
nonisolated func customizationID(_ id: String) -> some TabContent<Self.TabValue>
```

## Parameters

`id`

The identifier to associate with a tab or section.

## Discussion

The identifier needs to be stable, including across app version
updates.

Only the [`sidebarAdaptable`](/documentation/SwiftUI/TabViewStyle/sidebarAdaptable) style supports
supports customization. To enable customization, attach
a [`TabViewCustomization`](/documentation/SwiftUI/TabViewCustomization) to the [`TabView`](/documentation/SwiftUI/TabView) using
[`tabViewCustomization(_:)`](/documentation/SwiftUI/View/tabViewCustomization(_:)).

All tabs and tab sections that support customization are required to have
a customization ID. You can mark a tab as being non-customizable
by specifying a [`disabled`](/documentation/SwiftUI/TabCustomizationBehavior/disabled) behavior
in all adaptable tab bar placements
using [`customizationBehavior(_:for:)`](/documentation/SwiftUI/TabContent/customizationBehavior(_:for:)).

If you apply a customization ID to a [`TabSection`](/documentation/SwiftUI/TabSection), ensure you specify
customization IDs for all of the tabs within the section, unless the
tab has been marked as having customization turned off.

The following example adds customization identifiers to all tabs
and tab sections.

```
@AppStorage("MyAppTabViewCustomization")
private var customization: TabViewCustomization

TabView {
    Tab("Home", systemImage: "house") {
        HomeView()
    }
    .customizationID("com.myApp.home")

    Tab("Alerts", systemImage: "bell") {
        AlertsView()
    }
    .customizationID("com.myApp.bell")

    TabSection("Categories") {
        Tab("Climate", systemImage: "fan") {
            ClimateView()
        }
        .customizationID("com.myApp.climate")

        Tab("Lights", systemImage: "lightbulb") {
            LightsView()
        }
        .customizationID("com.myApp.lights")
    }
    .customizationID("com.myApp.categories")
}
.tabViewStyle(.sidebarAdaptable)
.tabViewCustomization($customization)
```

---

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)