Initializer

init(entity:sortDescriptors:predicate:animation:)

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

Declaration 宣言

init(entity: NSEntityDescription, sortDescriptors: [NSSortDescriptor], predicate: NSPredicate? = nil, animation: Animation? = nil)
Available when Result conforms to NSFetchRequestResult.

Parameters パラメータ

entity

The description of the Core Data entity to fetch.

sortDescriptors

An array of sort descriptors that define the sort order of the fetched results.

predicate

An 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 議論

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(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:animation:).

See Also 参照

Creating a Fetch Request フェッチリクエストを作成する