Contents

Query(filter:sort:transaction:)

Fetches and sorts the subset of the attached model type that satisfy the specified predicate.

Declaration

@attached(accessor) @attached(peer, names: prefixed(`_`)) macro Query<Element>(filter: Predicate<Element>? = nil, sort descriptors: [SortDescriptor<Element>] = [], transaction: Transaction? = nil) where Element : PersistentModel

Parameters

  • filter:

    The logical condition the query uses to determine if it returns a specific model instance.

  • descriptors:

    An array of sort descriptors to use when arranging the fetched models.

  • transaction:

    The transaction to use when updates to the fetched models trigger user interface changes.

See Also

Predicate-based queries