 import UIKit
 import CoreData
 
+class CollectionCoreDataChangeAction {
+    var indexPath: NSIndexPath?
+    var newIndexPath: NSIndexPath?
+    var changeType = NSFetchedResultsChangeType.Update
+    
+    static func action(atIndexPath: NSIndexPath?, changeType: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) -> CollectionCoreDataChangeAction {
+        let result = CollectionCoreDataChangeAction()
+        result.indexPath = atIndexPath
+        result.changeType = changeType
+        result.newIndexPath = newIndexPath
+        return result
+    }
+}
+
 let FetchedCollectionCellIdentifier = "FetchedCollectionCellIdentifier"
 
 public class FetchedCollectionViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, NSFetchedResultsControllerDelegate {

        let object = fetchedController.objectAtIndexPath(indexPath)
        tappedCell(indexPath, object: object)
    }
        
    func contentSizeChanged() {
        dispatch_async(dispatch_get_main_queue()) { () -> Void in
            self.collectionView.reloadData()
        }
    }
    
    public func createFetchedController() -> NSFetchedResultsController {

    @IBOutlet public var collectionView:UICollectionView!
    private var fetchedController:NSFetchedResultsController!
    private var measuringCell: UICollectionViewCell?
    private var changeActions:[CollectionCoreDataChangeAction]!
    
    public var ignoreOffScreenUpdates = false
    
    deinit {
        NSNotificationCenter.defaultCenter().removeObserver(self)
