Skip to content

Commit 87fa949

Browse files
committed
Consistent naming
1 parent afba2d3 commit 87fa949

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

CoreDataMigration-Example/CoreData/CoreDataManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ class CoreDataManager {
7272
fatalError("persistentContainer was not set up properly")
7373
}
7474

75-
if migrator.requiresMigration(storeURL: storeURL) {
75+
if migrator.requiresMigration(at: storeURL) {
7676
DispatchQueue.global(qos: .userInitiated).async {
77-
self.migrator.migrateStore(storeURL: storeURL)
77+
self.migrator.migrateStore(at: storeURL)
7878

7979
DispatchQueue.main.async {
8080
completion()

CoreDataMigration-Example/CoreData/Migration/CoreDataMigrator.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CoreDataMigrator {
2828

2929
// MARK: - Check
3030

31-
func requiresMigration(storeURL: URL, currentMigrationModel: CoreDataMigrationModel = CoreDataMigrationModel.current) -> Bool {
31+
func requiresMigration(at storeURL: URL, currentMigrationModel: CoreDataMigrationModel = CoreDataMigrationModel.current) -> Bool {
3232
guard let metadata = NSPersistentStoreCoordinator.metadata(at: storeURL) else {
3333
return false
3434
}
@@ -38,7 +38,7 @@ class CoreDataMigrator {
3838

3939
// MARK: - Migration
4040

41-
func migrateStore(storeURL: URL) {
41+
func migrateStore(at storeURL: URL) {
4242
migrateStore(from: storeURL, to: storeURL, targetVersion: CoreDataMigrationModel.current)
4343
}
4444

@@ -47,7 +47,7 @@ class CoreDataMigrator {
4747
fatalError("unknown store version at URL \(sourceURL)")
4848
}
4949

50-
forceWALCheckpointing(storeURL: sourceURL)
50+
forceWALCheckpointingForStore(at: sourceURL)
5151

5252
var currentURL = sourceURL
5353
let migrationSteps = sourceMigrationModel.migrationSteps(to: targetVersion)
@@ -79,7 +79,7 @@ class CoreDataMigrator {
7979

8080
// MARK: - WAL
8181

82-
func forceWALCheckpointing(storeURL: URL) {
82+
func forceWALCheckpointingForStore(at storeURL: URL) {
8383
guard let metadata = NSPersistentStoreCoordinator.metadata(at: storeURL) else {
8484
return
8585
}

CoreDataMigration-ExampleTests/CoreData/CoreDataManagerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ class CoreDataManagerTests: XCTestCase {
2020

2121
var requiresMigrationToBeReturned = false
2222

23-
override func requiresMigration(storeURL: URL, currentMigrationModel: CoreDataMigrationModel = CoreDataMigrationModel.current) -> Bool {
23+
override func requiresMigration(at: URL, currentMigrationModel: CoreDataMigrationModel = CoreDataMigrationModel.current) -> Bool {
2424
requiresMigrationWasCalled = true
2525

2626
return requiresMigrationToBeReturned
2727
}
2828

29-
override func migrateStore(storeURL: URL) {
29+
override func migrateStore(at: URL) {
3030
migrateStoreWasCalled = true
3131
}
3232
}

CoreDataMigration-ExampleTests/CoreData/Migration/CoreDataMigratorTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class CoreDataMigratorTests: XCTestCase {
115115
func test_requiresMigration_true() {
116116
let storeURL = CoreDataMigratorTests.moveFileFromBundleToTmpDirectory(fileName: "CoreDataMigration_Example_1.sqlite")
117117

118-
let requiresMigration = migrator.requiresMigration(storeURL: storeURL)
118+
let requiresMigration = migrator.requiresMigration(at: storeURL)
119119

120120
XCTAssertTrue(requiresMigration)
121121
}
@@ -124,7 +124,7 @@ class CoreDataMigratorTests: XCTestCase {
124124
let storeURL = CoreDataMigratorTests.moveFileFromBundleToTmpDirectory(fileName: "CoreDataMigration_Example_3.sqlite")
125125
let migrationModel = CoreDataMigrationModel(version: .version3)
126126

127-
let requiresMigration = migrator.requiresMigration(storeURL: storeURL, currentMigrationModel: migrationModel)
127+
let requiresMigration = migrator.requiresMigration(at: storeURL, currentMigrationModel: migrationModel)
128128

129129
XCTAssertFalse(requiresMigration)
130130
}
@@ -137,7 +137,7 @@ class CoreDataMigratorTests: XCTestCase {
137137

138138
let sizeBeforeCheckPointing = try! FileManager.default.attributesOfItem(atPath: storeURL.path)[FileAttributeKey.size] as! NSNumber
139139

140-
migrator.forceWALCheckpointing(storeURL: storeURL)
140+
migrator.forceWALCheckpointingForStore(at: storeURL)
141141

142142
let sizeAfterCheckPointing = try! FileManager.default.attributesOfItem(atPath: storeURL.path)[FileAttributeKey.size] as! NSNumber
143143

0 commit comments

Comments
 (0)