Section Index Label and Visibility
Sets the label that is used in a section index to point to this section, typically only a single character long. Changes the visibility of the list section index.
Platform Compatibility
Tags
SwiftUI Code
let items = ["Foo", "Bar"]
var body: some View {
List(items, id: \.self) { item in
Section(item) {
ForEach(0 ..< 42) { number in
Text(String(describing: number))
}
}
.sectionIndexLabel(item)
}
.listSectionIndexVisibility(.visible)
}