One Logo Pool Ball
SwiftData · IOS API REFERENCE

SectionedResults

struct · iOS 27.0+ · SDK 27.1

struct SectionedResults<Element, SectionTitle> where Element : PersistentModel, SectionTitle : Hashable

A `RandomAccessCollection` of ``ResultsSection`` instances representing sectioned query results. `SectionedResults` is the result type for sectioned `@Query` properties. Iterating it yields sections; each section is itself a `RandomAccessCollection` of model elements. Use ``subscript(sectionTitle:)`` for O(1) lookup by section title. @Query(sort: \.name, sectionBy: \.category) var items: SectionedResults<Item, String> ForEach(items) { section in // section: ResultsSection<Item, String> Section(section.title) { // "Work", "Personal", … ForEach(section) { item in … } // item: Item } } // O(1) named lookup let workCount = items[sectionTitle: "Work"]?.count ?? 0

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftData types →