---
title: "init(entity:sectionIdentifier:sortDescriptors:predicate:animation:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/sectionedfetchrequest/init(entity:sectionidentifier:sortdescriptors:predicate:animation:)"
---

# init(entity:sectionIdentifier:sortDescriptors:predicate:animation:)

Creates a sectioned fetch request for a specified entity description, based on a section identifier, a predicate, and sort parameters.

## Declaration

```swift
@MainActor @preconcurrency init(entity: NSEntityDescription, sectionIdentifier: KeyPath<Result, SectionIdentifier>, sortDescriptors: [NSSortDescriptor], predicate: NSPredicate? = nil, animation: Animation? = nil)
```

## Parameters

- `entity`: The description of the Core Data entity to fetch.
- `sectionIdentifier`: A key path that SwiftUI applies to the Result type to get an object’s section identifier.
- `sortDescriptors`: An array of sort descriptors that define the sort order of the fetched results.
- `predicate`: An doc://com.apple.documentation/documentation/Foundation/NSPredicate instance that defines logical conditions used to filter the fetched results.
- `animation`: The animation to use for user interface changes that result from changes to the fetched results.

## Discussion

Discussion Use this initializer if you need to explicitly specify the entity type for the request. If you specify a placeholder Result type in the request declaration, use the init(sectionIdentifier:sortDescriptors:predicate:animation:) initializer to let the request infer the entity type. If you need more control over the fetch request configuration, use init(fetchRequest:sectionIdentifier:animation:).

## See Also

### Creating a fetch request

- [init(sectionIdentifier:sortDescriptors:predicate:animation:)](swiftui/sectionedfetchrequest/init(sectionidentifier:sortdescriptors:predicate:animation:).md)
