<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UILocalizedIndexedCollation",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UILocalizedIndexedCollation"
  },
  "title" : "UILocalizedIndexedCollation"
}
-->

# UILocalizedIndexedCollation

An object that organizes, sorts, and localizes the data for a table view that has a section index.

```
@MainActor class UILocalizedIndexedCollation
```

## Overview

Use a [`UILocalizedIndexedCollation`](/documentation/UIKit/UILocalizedIndexedCollation) object in conjunction with your table’s data source object to sort and manage the data in an indexed table view. An index is an ideal way for users to navigate a table view containing sequential content. For example, the Contacts app sorts contacts alphabetically and displays an index for navigating those contacts quickly. You use the collation object as the source of the table’s section titles and index titles in your table view. You also use it to sort items in each section of your table.

To prepare the data for a section index, create an indexed-collation object and call [`section(for:collationStringSelector:)`](/documentation/UIKit/UILocalizedIndexedCollation/section(for:collationStringSelector:)) for each model object to be indexed. That method determines the section in which each of these objects should appear and returns an integer that identifies the section. The table-view controller then puts each object in a local array for its section. For each section array, the controller calls the [`sortedArray(from:collationStringSelector:)`](/documentation/UIKit/UILocalizedIndexedCollation/sortedArray(from:collationStringSelector:)) method to sort all of the objects in the section. The indexed-collation object is now the data store that the table-view controller uses to provide section-index data to the table view, as shown in the following example code.

```objc
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    return [[[UILocalizedIndexedCollation currentCollation] sectionTitles] objectAtIndex:section];
}
 
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
    return [[UILocalizedIndexedCollation currentCollation] sectionIndexTitles];
}
 
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{
    return [[UILocalizedIndexedCollation currentCollation] sectionForSectionIndexTitleAtIndex:index];
}
```

## Topics

### Getting the shared instance

[`+  currentCollation`](/documentation/UIKit/UILocalizedIndexedCollation/current())

Returns an indexed-collation instance for the current table view.

### Preparing the sections and section indexes

[`-  sectionForObject:collationStringSelector:`](/documentation/UIKit/UILocalizedIndexedCollation/section(for:collationStringSelector:))

Returns an integer identifying the section in which a model object belongs.

[`-  sortedArrayFromArray:collationStringSelector:`](/documentation/UIKit/UILocalizedIndexedCollation/sortedArray(from:collationStringSelector:))

Sorts the objects within a section by their localized titles.

### Providing section index data to the table view

[`sectionTitles`](/documentation/UIKit/UILocalizedIndexedCollation/sectionTitles)

Returns the list of section titles for the table view.

[`sectionIndexTitles`](/documentation/UIKit/UILocalizedIndexedCollation/sectionIndexTitles)

Returns the list of section-index titles for the table view.

[`-  sectionForSectionIndexTitleAtIndex:`](/documentation/UIKit/UILocalizedIndexedCollation/section(forSectionIndexTitle:))

Returns the section that the table view should scroll to for the given index title.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)