<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/SliderTickContentForEach/init(_:id:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI24SliderTickContentForEachV_2id7contentACyxq_q0_Gx_s7KeyPathCyqd__q_Gq0_qd__ctc7ElementQzRsd__5ValueQy0_AKRSlufc"
  },
  "title" : "init(_:id:content:)"
}
-->

# init(_:id:content:)

Creates an instance that uniquely identifies and creates slider ticks across
updates based on the provided key path to the underlying data’s
identifier.

```
nonisolated init<V>(_ data: Data, id: KeyPath<Data.Element, ID>, @SliderTickBuilder<V> content: @escaping (Data.Element) -> Content) where V == Data.Element, Data.Element == Content.Value
```

## Parameters

`data`

The data that the [`ForEach`](/documentation/SwiftUI/ForEach) instance uses to create mark items
dynamically.

`id`

The key path to the provided data’s identifier.

`content`

The builder that creates ticks dynamically.

## Discussion

It’s important that the `id` of a data element doesn’t change, unless
SwiftUI considers the data element to have been replaced with a new data
element that has a new identity. If the `id` of a data element changes,
then the marks generated from that data element will lose any
current state and animations.

---

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)