---
title: ResultsSectionCollection
framework: swiftdata
role: symbol
role_heading: Structure
path: swiftdata/resultssectioncollection
---

# ResultsSectionCollection

A collection of sections as returned by sections or Query.sections.

## Declaration

```swift
struct ResultsSectionCollection<Element, SectionName> where Element : PersistentModel, SectionName : Hashable
```

## Overview

Overview This is a lightweight RandomAccessCollection of ResultsSection instances, ordered by their first appearance in the sorted results. Because each section’s name is its identity, the collection provides O(1) lookup by section name via subscript(sectionName:) and contains(sectionName:). You typically access this collection through sections or Query.sections.

## Topics

### Finding sections

- [sectionNames](swiftdata/resultssectioncollection/sectionnames.md)
- [contains(sectionName:)](swiftdata/resultssectioncollection/contains(sectionname:).md)
- [index(ofSectionNamed:)](swiftdata/resultssectioncollection/index(ofsectionnamed:).md)

### Retrieving sections

- [subscript(sectionName:)](swiftdata/resultssectioncollection/subscript(sectionname:).md)
- [ResultsSection](swiftdata/resultssection.md)

## Relationships

### Conforms To

- [BidirectionalCollection](swift/bidirectionalcollection.md)
- [Collection](swift/collection.md)
- [RandomAccessCollection](swift/randomaccesscollection.md)
- [Sequence](swift/sequence.md)

## See Also

### Accessing sections

- [sections](swiftdata/query/sections.md)
