Skip to content

Commit bccf0d6

Browse files
Merge pull request #35 from michaelarmstrong/fix/Warning
Fixed warning "different optionality than expected by protocol 'NSFetchedResultsControllerDelegate"
2 parents 39579a1 + cae412b commit bccf0d6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

SuperRecord/SuperFetchedResultsControllerDelegate.swift

+11-10
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class SuperFetchedResultsControllerDelegate : NSObject, NSFetchedResultsControll
8484

8585
// !MARK : Reusable View Updates (UICollectionView / UITableView)
8686

87-
func controllerWillChangeContent(controller: NSFetchedResultsController!)
87+
func controllerWillChangeContent(controller: NSFetchedResultsController)
8888
{
8989
if(receiverType() == ReusableViewType.TableView){
9090
tableView!.beginUpdates()
@@ -93,7 +93,7 @@ class SuperFetchedResultsControllerDelegate : NSObject, NSFetchedResultsControll
9393
}
9494
}
9595

96-
func controller(controller: NSFetchedResultsController!, didChangeSection sectionInfo: NSFetchedResultsSectionInfo!, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType)
96+
func controller(controller: NSFetchedResultsController, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType)
9797
{
9898
if(receiverType() == .TableView){
9999
if type == NSFetchedResultsChangeType.Insert {
@@ -117,22 +117,23 @@ class SuperFetchedResultsControllerDelegate : NSObject, NSFetchedResultsControll
117117
}
118118
}
119119

120-
func controller(controller: NSFetchedResultsController!, didChangeObject anObject: AnyObject!, atIndexPath indexPath: NSIndexPath!, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath!)
120+
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?)
121121
{
122122
if(receiverType() == ReusableViewType.TableView){
123123
switch type {
124124
case NSFetchedResultsChangeType.Insert:
125-
tableView!.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: UITableViewRowAnimation.Fade)
125+
tableView!.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: UITableViewRowAnimation.Fade)
126126
case NSFetchedResultsChangeType.Delete:
127-
tableView!.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
127+
tableView!.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: UITableViewRowAnimation.Fade)
128128
case NSFetchedResultsChangeType.Update:
129-
tableView!.reloadRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
129+
tableView!.reloadRowsAtIndexPaths([indexPath!], withRowAnimation: UITableViewRowAnimation.Fade)
130130
case NSFetchedResultsChangeType.Move:
131-
tableView!.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
132-
tableView!.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: UITableViewRowAnimation.Fade)
131+
tableView!.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: UITableViewRowAnimation.Fade)
132+
tableView!.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: UITableViewRowAnimation.Fade)
133133
default:
134134
println("Unexpected NSFetchedResultsChangeType received for didChangeObject. \(type)")
135135
}
136+
136137
} else if(receiverType() == ReusableViewType.CollectionView) {
137138
var changeDictionary : Dictionary<NSFetchedResultsChangeType,AnyObject> = Dictionary()
138139

@@ -148,7 +149,7 @@ class SuperFetchedResultsControllerDelegate : NSObject, NSFetchedResultsControll
148149
break;
149150
case NSFetchedResultsChangeType.Move:
150151
// !TODO : we may need to migrate this to a homogenous Array as I expect this to throw a runtime exception.
151-
changeDictionary[type] = [indexPath, newIndexPath]
152+
changeDictionary[type] = [indexPath!, newIndexPath!]
152153
break;
153154
default:
154155
println("Unexpected NSFetchedResultsChangeType received for didChangeObject. \(type)")
@@ -157,7 +158,7 @@ class SuperFetchedResultsControllerDelegate : NSObject, NSFetchedResultsControll
157158
}
158159
}
159160

160-
func controllerDidChangeContent(controller: NSFetchedResultsController!)
161+
func controllerDidChangeContent(controller: NSFetchedResultsController)
161162
{
162163
if(receiverType() == ReusableViewType.TableView){
163164
tableView!.endUpdates()

0 commit comments

Comments
 (0)