How to sort Core Data fetched properties

前端 未结 8 2050
太阳男子
太阳男子 2020-12-12 15:30

The Core Data Documentation states that:

The fetch request associated with the [fetched] property can have a sort ordering, and thus the fetched prope

8条回答
  •  春和景丽
    2020-12-12 15:47

    The modeling tool doesn't appear to have a way to set the sort descriptors on the fetch request.

    It should be possible[1] to, after loading the model but before associating it with a persistent store coordinator, to find the fetched property descriptions for which you want to control the sort order, and replace their fetch requests with fetch requests that have sort descriptors set on them.

    [1] In principle this should work. In practice, I have not done so or tested it.

提交回复
热议问题