<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: -",
    "macOS: 14.0.0 -",
    "swift: 5.8.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSCustomMigrationStage/didMigrateHandler-2zbss",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Core Data",
      "CoreData"
    ],
    "preciseIdentifier" : "s:So22NSCustomMigrationStageC8CoreDataE17didMigrateHandlerySo08NSStagedB7ManagerC_ABtKcSgvp"
  },
  "title" : "didMigrateHandler"
}
-->

# didMigrateHandler

The handler to execute after the stage runs.

```
var didMigrateHandler: ((NSStagedMigrationManager, NSCustomMigrationStage) throws -> Void)? { get set }
```

## Discussion

Use this handler to perform any cleanup tasks on the persistent store’s data after the migration has run. Access the store using the [`container`](/documentation/CoreData/NSStagedMigrationManager/container) property of the handler’s `migrationManager` parameter.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)