mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-24 04:03:03 -04:00
Library: Remove force unwrap in FetchedResultsControllerDelegate
This commit is contained in:
parent
cd6089de3b
commit
873ff5cd62
@ -273,15 +273,18 @@ class LibraryDownloadTBVC: UITableViewController, NSFetchedResultsControllerDele
|
||||
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {
|
||||
switch type {
|
||||
case .Insert:
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .Fade)
|
||||
guard let newIndexPath = newIndexPath else {return}
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Fade)
|
||||
case .Delete:
|
||||
tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Fade)
|
||||
guard let indexPath = indexPath else {return}
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
|
||||
case .Update:
|
||||
guard let indexPath = indexPath, let cell = tableView.cellForRowAtIndexPath(indexPath) else {return}
|
||||
configureCell(cell, atIndexPath: indexPath)
|
||||
case .Move:
|
||||
tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Fade)
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .Fade)
|
||||
guard let indexPath = indexPath, let newIndexPath = newIndexPath else {return}
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Fade)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -238,15 +238,18 @@ class LibraryLocalTBVC: UITableViewController, NSFetchedResultsControllerDelegat
|
||||
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {
|
||||
switch type {
|
||||
case .Insert:
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .Fade)
|
||||
guard let newIndexPath = newIndexPath else {return}
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Fade)
|
||||
case .Delete:
|
||||
tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Fade)
|
||||
guard let indexPath = indexPath else {return}
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
|
||||
case .Update:
|
||||
guard let indexPath = indexPath, let cell = tableView.cellForRowAtIndexPath(indexPath) else {return}
|
||||
configureCell(cell, atIndexPath: indexPath)
|
||||
case .Move:
|
||||
tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Fade)
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .Fade)
|
||||
guard let indexPath = indexPath, let newIndexPath = newIndexPath else {return}
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Fade)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -354,15 +354,18 @@ class LibraryOnlineTBVC: UITableViewController, NSFetchedResultsControllerDelega
|
||||
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {
|
||||
switch type {
|
||||
case .Insert:
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .Fade)
|
||||
guard let newIndexPath = newIndexPath else {return}
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Fade)
|
||||
case .Delete:
|
||||
tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Fade)
|
||||
guard let indexPath = indexPath else {return}
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
|
||||
case .Update:
|
||||
guard let indexPath = indexPath, let cell = tableView.cellForRowAtIndexPath(indexPath) else {return}
|
||||
configureCell(cell, atIndexPath: indexPath)
|
||||
case .Move:
|
||||
tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Fade)
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .Fade)
|
||||
guard let indexPath = indexPath, let newIndexPath = newIndexPath else {return}
|
||||
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
|
||||
tableView.insertRowsAtIndexPaths([newIndexPath], withRowAnimation: .Fade)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user