let id: SectionIdentifier
Overview 概要
Examine a Section
instance to find the entities that satisfy a Sectioned
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 section
parameter during initialization, or by modifying the corresponding Sectioned
instance’s section
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:
<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 operations like the count
method in the example above.