0

Does a NSFetchedResultsController assign values for the attribute identified by sectionNameKeyPath to sections always in ascending order?

For instance if my sectionNameKeyPath were an (optional) boolean attribute with values @(YES), @(NO), @(YES), would the first section receive one row (because NO corresponds to 0) and the second section receive two (because YES corresponds to 1)?

So is that the case and if that is, can one change the order (without introducing another attribute that "inverses" the first)?

Drux
  • 11,992
  • 13
  • 66
  • 116

1 Answers1

1

sortDescriptors is what actually sorts the objects. sectionNameKeyPath simply describes where the section borders should be given that sorting (one section per unique value).

Andy Riordan
  • 1,154
  • 1
  • 8
  • 13
  • True. I had forgotten to set a primary sort descriptor on `sectionNameKeyPath` (for ordering the sections) next to the (now secondary) sort descriptor (for ordering objects inside sections) in `NSFetchedResultsController`s fetch request. – Drux Feb 12 '15 at 12:43