Skip to content

Commit afba2d3

Browse files
committed
Removed unneeded chaining
1 parent d623a24 commit afba2d3

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

CoreDataMigration-Example/CoreData/Migration/CoreDataMigrator.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,15 @@ class CoreDataMigrator {
9292
return
9393
}
9494

95-
let model = currentCoreDataStoreMigrationVersionModel.managedObjectModel()
96-
let persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: model)
97-
98-
let options = [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
99-
persistentStoreCoordinator.addPersistentStore(at: storeURL, options: options)
100-
persistentStoreCoordinator.removeStore(at: storeURL)
95+
do {
96+
let model = currentCoreDataStoreMigrationVersionModel.managedObjectModel()
97+
let persistentStoreCoordinator = NSPersistentStoreCoordinator(managedObjectModel: model)
98+
99+
let options = [NSSQLitePragmasOption: ["journal_mode": "DELETE"]]
100+
let store = persistentStoreCoordinator.addPersistentStore(at: storeURL, options: options)
101+
try persistentStoreCoordinator.remove(store)
102+
} catch let error {
103+
fatalError("failed to force WAL checkpointing, error: \(error)")
104+
}
101105
}
102106
}

CoreDataMigration-Example/Extensions/NSPersistentStoreCoordinator/NSPersistentStoreCoordinator+SQLite.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,6 @@ extension NSPersistentStoreCoordinator {
2121
}
2222
}
2323

24-
// MARK: - Remove
25-
26-
func removeStore(at storeURL: URL) {
27-
guard let persistentStore = persistentStore(for: storeURL) else {
28-
return
29-
}
30-
31-
do {
32-
try remove(persistentStore)
33-
} catch let error {
34-
fatalError("failed to remove persistent store at \(storeURL), error: \(error)")
35-
}
36-
}
37-
3824
// MARK: - Replace
3925

4026
static func replaceStore(at targetURL: URL, withStoreAt sourceURL: URL) {

0 commit comments

Comments
 (0)