 
 extension DataSource : SequenceType {
 	
-	public func generate() -> IndexingGenerator<[NSManagedObject]> {
-		let objects = self.fetchedResults.fetchedObjects as [NSManagedObject]
+	public func generate() -> IndexingGenerator<[D.ManagedObject]> {
+		let objects = self.fetchedResults.fetchedObjects as [D.ManagedObject]
 		return objects.generate()
 	}
 }

		self.delete(object)
	}
	
	public func delete(object:NSManagedObject) {
		
		self.context.performBlockAndWait {
			var error:NSError?

import CoreData


public protocol DataSourceDelegate : class {
	
	typealias Associate
	typealias ManagedObject
	
	func dataSourceWillChangeContent(dataSource:DataSource<Self>)
	func dataSourceDidChangeContent(dataSource:DataSource<Self>)
	
	func dataSource(dataSource:DataSource<Self>, didInsert section:Int)
	func dataSource(dataSource:DataSource<Self>, didDelete section:Int)
	
	func dataSource(dataSource:DataSource<Self>, didInsert object:ManagedObject, at indexPath:NSIndexPath)
	func dataSource(dataSource:DataSource<Self>, didDelete object:ManagedObject, at indexPath:NSIndexPath)
	func dataSource(dataSource:DataSource<Self>, didUpdate object:ManagedObject, at indexPath:NSIndexPath)
	func dataSource(dataSource:DataSource<Self>, didMove object:ManagedObject, at indexPath:NSIndexPath, to:NSIndexPath)
	
	func dataSource(dataSource:DataSource<Self>, associateFor object:ManagedObject, at indexPath:NSIndexPath) -> Associate
	func dataSource(dataSource:DataSource<Self>, shouldDelete object:ManagedObject, at indexPath:NSIndexPath)
}


//MARK: -

public class DataSource<D:DataSourceDelegate where D.ManagedObject == NSManagedObject> : NSFetchedResultsControllerDelegate {

	public weak var delegate:D?
	
	public let context:NSManagedObjectContext
	public let request:NSFetchRequest
