diff --git a/SuperRecord/SuperFetchedResultsControllerDelegate.swift b/SuperRecord/SuperFetchedResultsControllerDelegate.swift index 293f27e..ee65fb8 100644 --- a/SuperRecord/SuperFetchedResultsControllerDelegate.swift +++ b/SuperRecord/SuperFetchedResultsControllerDelegate.swift @@ -84,7 +84,7 @@ class SuperFetchedResultsControllerDelegate : NSObject, NSFetchedResultsControll // !MARK : Reusable View Updates (UICollectionView / UITableView) - func controllerWillChangeContent(controller: NSFetchedResultsController!) + func controllerWillChangeContent(controller: NSFetchedResultsController) { if(receiverType() == ReusableViewType.TableView){ tableView!.beginUpdates() @@ -93,7 +93,7 @@ class SuperFetchedResultsControllerDelegate : NSObject, NSFetchedResultsControll } } - func controller(controller: NSFetchedResultsController!, didChangeSection sectionInfo: NSFetchedResultsSectionInfo!, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType) + func controller(controller: NSFetchedResultsController, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType) { if(receiverType() == .TableView){ if type == NSFetchedResultsChangeType.Insert { @@ -117,22 +117,23 @@ class SuperFetchedResultsControllerDelegate : NSObject, NSFetchedResultsControll } } - func controller(controller: NSFetchedResultsController!, didChangeObject anObject: AnyObject!, atIndexPath indexPath: NSIndexPath!, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath!) + func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) { if(receiverType() == ReusableViewType.TableView){ switch type { case NSFetchedResultsChangeType.Insert: - tableView!.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: UITableViewRowAnimation.Fade) + tableView!.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: UITableViewRowAnimation.Fade) case NSFetchedResultsChangeType.Delete: - tableView!.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade) + tableView!.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: UITableViewRowAnimation.Fade) case NSFetchedResultsChangeType.Update: - tableView!.reloadRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade) + tableView!.reloadRowsAtIndexPaths([indexPath!], withRowAnimation: UITableViewRowAnimation.Fade) case NSFetchedResultsChangeType.Move: - tableView!.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade) - tableView!.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: UITableViewRowAnimation.Fade) + tableView!.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: UITableViewRowAnimation.Fade) + tableView!.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: UITableViewRowAnimation.Fade) default: println("Unexpected NSFetchedResultsChangeType received for didChangeObject. \(type)") } + } else if(receiverType() == ReusableViewType.CollectionView) { var changeDictionary : Dictionary = Dictionary() @@ -148,7 +149,7 @@ class SuperFetchedResultsControllerDelegate : NSObject, NSFetchedResultsControll break; case NSFetchedResultsChangeType.Move: // !TODO : we may need to migrate this to a homogenous Array as I expect this to throw a runtime exception. - changeDictionary[type] = [indexPath, newIndexPath] + changeDictionary[type] = [indexPath!, newIndexPath!] break; default: println("Unexpected NSFetchedResultsChangeType received for didChangeObject. \(type)") @@ -157,7 +158,7 @@ class SuperFetchedResultsControllerDelegate : NSObject, NSFetchedResultsControll } } - func controllerDidChangeContent(controller: NSFetchedResultsController!) + func controllerDidChangeContent(controller: NSFetchedResultsController) { if(receiverType() == ReusableViewType.TableView){ tableView!.endUpdates()