---
title: "init(_:id:textRange:prepare:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/accessibilityrotorentry/init(_:id:textrange:prepare:)"
---

# init(_:id:textRange:prepare:)

Create a Rotor entry with a specific label and identifier, with an optional range.

## Declaration

```swift
init(_ label: LocalizedStringResource, id: ID, textRange: Range<String.Index>? = nil, prepare: @escaping () -> Void = {})
```

## Parameters

- `label`: Localized string used to show this Rotor entry to users.
- `id`: Used to find the UI element associated with this Rotor entry. This identifier should be used within a scrollView, either in a ForEach or using an id call.
- `textRange`: Optional range of text associated with this Rotor entry. This should be a range within text that is set as the accessibility label or accessibility value of the associated element.
- `prepare`: Optional closure to run before a Rotor entry is navigated to, to prepare the UI as needed. This can be used to bring the UI element on-screen if it isn’t already, and SwiftUI is not able to automatically scroll to it.

## See Also

### Creating a rotor entry

- [init(_:textRange:prepare:)](swiftui/accessibilityrotorentry/init(_:textrange:prepare:).md)
