---
title: SectionedFetchResults.Section
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/sectionedfetchresults/section
---

# SectionedFetchResults.Section

A collection of fetched results that share a specified identifier.

## Declaration

```swift
@MainActor @preconcurrency struct Section
```

## Overview

Overview Examine a Section instance to find the entities that satisfy a SectionedFetchRequest predicate, and that have a particular property with the value stored in the section’s id parameter. You specify which property by setting the fetch request’s sectionIdentifier parameter during initialization, or by modifying the corresponding SectionedFetchResults instance’s sectionIdentifier property. Obtain specific sections by treating the fetch results as a collection. For example, consider the following property declaration that fetches Quake managed objects that the Loading and Displaying a Large Data Feed sample code project defines to store earthquake data: @SectionedFetchRequest<String, Quake>(     sectionIdentifier: \.day,     sortDescriptors: [SortDescriptor(\.time, order: .reverse)] ) private var quakes: SectionedFetchResults<String, Quake> Get the first section using a subscript: let firstSection = quakes[0] Alternatively, you can loop over the sections to create a list of sections. ForEach(quakes) { section in     Text("Section \(section.id) has \(section.count) elements") } The sections also act as collections, which means you can use elements like the count property in the example above.

## Topics

### Identifying the section

- [id](swiftui/sectionedfetchresults/section/id.md)

### Getting indices

- [startIndex](swiftui/sectionedfetchresults/section/startindex.md)
- [endIndex](swiftui/sectionedfetchresults/section/endindex.md)

### Getting results

- [subscript(_:)](swiftui/sectionedfetchresults/section/subscript(_:).md)

## Relationships

### Conforms To

- [BidirectionalCollection](swift/bidirectionalcollection.md)
- [Collection](swift/collection.md)
- [Identifiable](swift/identifiable.md)
- [RandomAccessCollection](swift/randomaccesscollection.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Sequence](swift/sequence.md)

## See Also

### Configuring the associated sectioned fetch request

- [nsPredicate](swiftui/sectionedfetchresults/nspredicate.md)
- [sortDescriptors](swiftui/sectionedfetchresults/sortdescriptors.md)
- [nsSortDescriptors](swiftui/sectionedfetchresults/nssortdescriptors.md)
- [sectionIdentifier](swiftui/sectionedfetchresults/sectionidentifier.md)
