Q:

How can I create NSFetchedResultsController that stores items in sections level and not in row?

I need this:

section0, row0: element0
section1, row0: element1
section2, row0: element2

Now I create FRC like this:
let fr = NSFetchRequest(entityName: "lc")
fr.sortDescriptors = [NSSortDescriptor(key: "vf", ascending: false)]
frc = NSFetchedResultsController(fetchRequest: fr, managedObjectContext: Utility.managedObjectContext(), sectionNameKeyPath: nil, cacheName: nil)
frc!.delegate = self
frc!.performFetch(nil)

but it creates one section, and multiple rows, like this:

section0, row0: element0
section0, row1: element1
section0, row2: element2

A:

You have to set the sectionNameKeyPath in the initializer for the NSFetchedResultsController. This will then create sectioned off content, where each section will have a different value for that keypath.

