diff --git a/CoreStore/Fetching and Querying/BaseDataTransaction+Querying.swift b/CoreStore/Fetching and Querying/BaseDataTransaction+Querying.swift index 4f2cd25..f199328 100644 --- a/CoreStore/Fetching and Querying/BaseDataTransaction+Querying.swift +++ b/CoreStore/Fetching and Querying/BaseDataTransaction+Querying.swift @@ -80,12 +80,10 @@ public extension BaseDataTransaction { var existingObjects = [T]() for object in objects { - do { + if let existingObject = (try? self.context.existingObjectWithID(object.objectID)) as? T { - let existingObject = try self.context.existingObjectWithID(object.objectID) as! T existingObjects.append(existingObject) } - catch _ { } } return existingObjects } @@ -101,12 +99,10 @@ public extension BaseDataTransaction { var existingObjects = [T]() for objectID in objectIDs { - do { + if let existingObject = (try? self.context.existingObjectWithID(objectID)) as? T { - let existingObject = try self.context.existingObjectWithID(objectID) as! T existingObjects.append(existingObject) } - catch _ { } } return existingObjects } diff --git a/CoreStore/Fetching and Querying/DataStack+Querying.swift b/CoreStore/Fetching and Querying/DataStack+Querying.swift index cdec5fd..601f4b1 100644 --- a/CoreStore/Fetching and Querying/DataStack+Querying.swift +++ b/CoreStore/Fetching and Querying/DataStack+Querying.swift @@ -81,12 +81,10 @@ public extension DataStack { var existingObjects = [T]() for object in objects { - do { + if let existingObject = (try? self.mainContext.existingObjectWithID(object.objectID)) as? T { - let existingObject = try self.mainContext.existingObjectWithID(object.objectID) as! T existingObjects.append(existingObject) } - catch _ { } } return existingObjects } @@ -102,12 +100,10 @@ public extension DataStack { var existingObjects = [T]() for objectID in objectIDs { - do { + if let existingObject = (try? self.mainContext.existingObjectWithID(objectID)) as? T { - let existingObject = try self.mainContext.existingObjectWithID(objectID) as! T existingObjects.append(existingObject) } - catch _ { } } return existingObjects } diff --git a/CoreStore/Importing Data/BaseDataTransaction+Importing.swift b/CoreStore/Importing Data/BaseDataTransaction+Importing.swift index 4fdfe7b..991628d 100644 --- a/CoreStore/Importing Data/BaseDataTransaction+Importing.swift +++ b/CoreStore/Importing Data/BaseDataTransaction+Importing.swift @@ -201,7 +201,7 @@ public extension BaseDataTransaction { } } - for object in self.fetchAll(From(T), Where("%K IN %@", T.uniqueIDKeyPath, mapping.keys.array)) ?? [] { + for object in self.fetchAll(From(T), Where("%K IN %@", T.uniqueIDKeyPath, Array(mapping.keys))) ?? [] { try autoreleasepool { @@ -261,7 +261,7 @@ public extension BaseDataTransaction { } var objects = Dictionary() - for object in self.fetchAll(From(T), Where("%K IN %@", T.uniqueIDKeyPath, mapping.keys.array)) ?? [] { + for object in self.fetchAll(From(T), Where("%K IN %@", T.uniqueIDKeyPath, Array(mapping.keys))) ?? [] { try autoreleasepool { diff --git a/CoreStore/Migrating/DataStack+Migration.swift b/CoreStore/Migrating/DataStack+Migration.swift index f1720f3..af7c05e 100644 --- a/CoreStore/Migrating/DataStack+Migration.swift +++ b/CoreStore/Migrating/DataStack+Migration.swift @@ -436,7 +436,7 @@ public extension DataStack { let migrationOperation = NSBlockOperation() migrationOperation.qualityOfService = .Utility - operations.map { migrationOperation.addDependency($0) } + operations.forEach { migrationOperation.addDependency($0) } migrationOperation.addExecutionBlock { () -> Void in GCDQueue.Main.async { diff --git a/CoreStore/Migrating/MigrationChain.swift b/CoreStore/Migrating/MigrationChain.swift index 784c579..79ee8c0 100644 --- a/CoreStore/Migrating/MigrationChain.swift +++ b/CoreStore/Migrating/MigrationChain.swift @@ -237,9 +237,9 @@ extension MigrationChain: CustomDebugStringConvertible { steps.append(nextVersion) version = nextVersion } - paths.append(" → ".join(steps)) + paths.append(steps.joinWithSeparator(" → ")) } - return "[" + "], [".join(paths) + "]" + return "[" + paths.joinWithSeparator("], [") + "]" } } diff --git a/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift b/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift index 5c4908c..2cb76ec 100644 --- a/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift +++ b/CoreStoreDemo/CoreStoreDemo/MIgrations Demo/MigrationsDemoViewController.swift @@ -285,7 +285,7 @@ class MigrationsDemoViewController: UIViewController { } self.titleLabel?.text = organismType - self.organismLabel?.text = "\n".join(lines) + self.organismLabel?.text = lines.joinWithSeparator("\n") self.progressView?.progress = 0 self.headerContainer?.setNeedsLayout() diff --git a/CoreStoreTests/CoreStoreTests.swift b/CoreStoreTests/CoreStoreTests.swift index 423b7d3..81bc2a2 100644 --- a/CoreStoreTests/CoreStoreTests.swift +++ b/CoreStoreTests/CoreStoreTests.swift @@ -377,8 +377,9 @@ class CoreStoreTests: XCTestCase { do { - try NSFileManager.defaultManager().removeItemAtURL( - NSFileManager.defaultManager().URLsForDirectory(.ApplicationSupportDirectory, inDomains: .UserDomainMask).first! + let fileManager = NSFileManager.defaultManager() + try fileManager.removeItemAtURL( + fileManager.URLsForDirectory(.ApplicationSupportDirectory, inDomains: .UserDomainMask).first! ) } catch _ { }