Skip to content

Instantly share code, notes, and snippets.

View lukasredev's full-sized avatar

Lukas Reichling lukasredev

  • Zurich Switzerland
View GitHub Profile
@lukasredev
lukasredev / gist:0ce6b782a5428bd17904
Created February 4, 2015 13:01
UICollectionView w/ NSFetchedResultsController & NSBlockOperation. Idea originated from Blake Watters (https://github.com/AshFurrow/UICollectionView-NSFetchedResultsController/issues/13) Swift Version
func controllerWillChangeContent(controller: NSFetchedResultsController) {
self.shouldReloadCollectionView = false
self.blockOperation = NSBlockOperation()
}
func controller(controller: NSFetchedResultsController, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType) {
let collectionView = self.collectionView
switch type {
case NSFetchedResultsChangeType.Insert:
self.blockOperation.addExecutionBlock({