How to detect if a migration is required?

Hello,

With Core Data, we can use the isConfiguration(withName:compatibleWithStoreMetadata:) method on an NSManagedObjectModel alongside metadata(for:) on NSPersistentStoreCoordinator to check if the on-disk store is up to date or not.

Is this the way to do it too with SwiftData or do we have an easier way to check if the on-disk store will need to migrate?

I want to inform my users in the UI when the app launches (or from widgets or app intents).

Regards,

Axel

How to detect if a migration is required?
 
 
Q