 import CoreData
 
 class ToDoListController: NSFetchedResultsControllerDelegate {
-    
-    class ControllerSectionInfo: NSFetchedResultsSectionInfo {
-        let section: ToDoSection
-        let fetchedIndex: Int?
-        private let fetchController: NSFetchedResultsController
-        
-        init(section: ToDoSection, fetchedIndex: Int?, fetchController: NSFetchedResultsController) {
-            self.section = section
-            self.fetchedIndex = fetchedIndex
-            self.fetchController = fetchController
-        }
-        
-        var name: String! { return section.title() }
-        var indexTitle: String! { return nil }
-        var numberOfObjects: Int {
-            if fetchedInfo { return fetchedInfo!.numberOfObjects }
-            else { return 0 }
-        }
-        var objects: [AnyObject]! { return fetchedInfo?.objects }
-        var fetchedInfo: NSFetchedResultsSectionInfo? {
-            if fetchedIndex {
-                return fetchController.sections[fetchedIndex!] as? NSFetchedResultsSectionInfo
-            } else {
-                return nil
-            }
-        }
-    }
     
     var delegate: NSFetchedResultsControllerDelegate?
     

    }
    
    func fetchedToDos() -> [ToDo] {
        return toDosController.fetchedObjects as [ToDo]
    }
    
    func toDoAtIndexPath(indexPath: NSIndexPath) -> ToDo {
        let sectionInfo = sections[indexPath.section]
        return toDosController.objectAtIndexPath(NSIndexPath(forRow: indexPath.row, inSection: sectionInfo.fetchedIndex!)) as ToDo
    }
    
    func reloadData() {

        return nil
    }
}

class ControllerSectionInfo: NSFetchedResultsSectionInfo {
    let section: ToDoSection
    let fetchedIndex: Int?
    private let fetchController: NSFetchedResultsController
    
    init(section: ToDoSection, fetchedIndex: Int?, fetchController: NSFetchedResultsController) {
        self.section = section
        self.fetchedIndex = fetchedIndex
        self.fetchController = fetchController
    }
    
    var name: String! { return section.title() }
    var indexTitle: String! { return nil }
    var numberOfObjects: Int {
    if fetchedInfo { return fetchedInfo!.numberOfObjects }
    else { return 0 }
    }
    var objects: [AnyObject]! { return fetchedInfo?.objects }
    var fetchedInfo: NSFetchedResultsSectionInfo? {
    if fetchedIndex {
        return fetchController.sections[fetchedIndex!] as? NSFetchedResultsSectionInfo
    } else {
        return nil
        }
    }
}
