1

Is it possible to create an NSFetchedResultsController separated into sections based on the output of a method? For example, if the Core Data model is a person, can you separate them into generation-x, generation-y, baby boomers, etc. (when date-of-birth is the core data field and the function for evaluating the generation is relatively trivial?).

Kevin Sylvestre
  • 37,288
  • 33
  • 152
  • 232

2 Answers2

3

Yes. Create a transient property in your object model so you can make the appropriate calculations and assign the result to it. Then simply ask the fetchedResultsController to use this property for the table sections.

Rog
  • 18,602
  • 6
  • 76
  • 97
2

You can also do this with a category method on NSDate as explained by @jbrennan in Using custom sections with NSFetchedResultsController?

Community
  • 1
  • 1
ma11hew28
  • 121,420
  • 116
  • 450
  • 651