I have an instance of the Department entity, which in turn has a relationship to the Employee entity via the ’employees’ to-many relationship.
How would I construct my NSPredicate to return an array of employees within the specific department, in employeeNumber order, from this Department instance?
A predicate’s purpose is to filter items, not to sort them. Use your fetch request’s
sortDescriptorsproperty to determine how the results are sorted.Alternatively, if you’re accessing the relationship via the object’s properties, use the
NSSetmethodsortedArrayUsingDescriptors:to create a sorted array from the set of objects.