init(fetchDescriptor:sectionBy:modelContext:isolation:)
Creates a new observer with the given fetch descriptor, an optional String section key path, and a model context.
Declaration
convenience init(fetchDescriptor: FetchDescriptor<Element> = FetchDescriptor<Element>(), sectionBy: KeyPath<Element, String?>, modelContext: ModelContext, isolation: isolated (any Actor)? = #isolation) throwsParameters
- fetchDescriptor:
The descriptor defining the fetch criteria.
- sectionBy:
A key path on the element type that returns an optional section name.
- modelContext:
The model context to fetch from and observe for changes.
Discussion
Use this initializer when the section key path points to an optional String property. Elements whose section value is nil are grouped into a section with an empty name.