How to put app-specific logic between migration steps?

There was a section in the talk about how we can break down migration into smaller changes, and that we have an opportunity to run app-specific code in between migration steps. However the talk didn't touch on how can can achieve this, besides a single sentence, which doesn't give enough detail at least for me to figure out how to do it.

Intuitively, an event loop could be built that opens the persistent store with the lightweight migration options set and iteratively steps through each unprocessed model in a serial order, and Core Data will migrate the store.

Given the automatic nature of the lightweight migrations, especially in the case where we're using NSPersistentCoordinator, doesn't the automatic system just zoom through all of the migrations from model A --> A' --> A'' -> B? How to we make it stop so we can execute our own app code?

Thanks!

Post not yet marked as solved Up vote post of json Down vote post of json
931 views

Replies

Have you found an answer to your question? I have the same and I am not sure how to limit from A to A' then run some code before running the migration from A' to A". Should we specify the model version for the step to execute, then run some logic, then redo the same for another model version?

I am also struggling with this as well and can't find anything in the docs related to lightweight migration.

They say "The code to import this data is separate from the functionality provided by Core Data. The execution of this import is interposed between migrations."