From 0b6298a802de06fed44d84727255d88443be0bbd Mon Sep 17 00:00:00 2001 From: John Rommel Estropia Date: Wed, 7 Oct 2015 00:57:48 +0900 Subject: [PATCH] tidy up --- .../Internal/FetchedResultsControllerDelegate.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CoreStore/Internal/FetchedResultsControllerDelegate.swift b/CoreStore/Internal/FetchedResultsControllerDelegate.swift index 60cd459..87799b9 100644 --- a/CoreStore/Internal/FetchedResultsControllerDelegate.swift +++ b/CoreStore/Internal/FetchedResultsControllerDelegate.swift @@ -82,10 +82,11 @@ internal final class FetchedResultsControllerDelegate: NSObject, NSFetchedResult @objc dynamic func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) { - // This fix is for a bug where Apple passes 0 for NSFetchedResultsChangeType, but this is not a valid enum case. - // Swift will then always execute the first case of the switch causing strange behaviour. - // https://forums.developer.apple.com/thread/12184#31850 - if type.rawValue == 0 { + guard type.rawValue > 0 else { + + // This fix is for a bug where Apple passes 0 for NSFetchedResultsChangeType, but this is not a valid enum case. + // Swift will then always execute the first case of the switch causing strange behaviour. + // https://forums.developer.apple.com/thread/12184#31850 return }