Query(filter:sort:order:animation:)
Fetches a subset of the attached model type, in a specific order, by sorting on a nonoptional attribute.
Declaration
@attached(accessor) @attached(peer, names: prefixed(`_`)) macro Query<Value, Element>(filter: Predicate<Element>? = nil, sort keyPath: KeyPath<Element, Value>, order: SortOrder = .forward, animation: Animation) where Value : Comparable, Element : PersistentModelParameters
- filter:
The logical condition the query uses to determine if it returns a specific model instance.
- keyPath:
The keypath of the nonoptional attribute to sort by.
- order:
The order of the sort.
- animation:
The animation to use when updates to the fetched models trigger user interface changes.