---
title: willMigrateHandler
framework: coredata
role: symbol
role_heading: Instance Property
path: coredata/nscustommigrationstage/willmigratehandler-5wead
---

# willMigrateHandler

The handler to execute before the stage runs.

## Declaration

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

## Discussion

Discussion Use this handler to prepare the persistent store’s data for the pending migration. Access the store using the container property of the handler’s migrationManager parameter.

## See Also

### Assigning event handlers

- [didMigrateHandler](coredata/nscustommigrationstage/didmigratehandler-2zbss.md)
