Josh Paradroid
Josh Paradroid

Reputation: 1414

How do I get the URL of a Core Data persistent store for deletion?

I wish to call the function persistentStoreCoordinator.destroyPersistentStoreAtURL(...). I'm creating my container with it like this NSPersistentContainer(name: "MyProject") what I would like to know is how to get the URL of the persistentStore for use in the first call, in Swift preferably.

Many thanks.

Upvotes: 3

Views: 1454

Answers (1)

pfandrade
pfandrade

Reputation: 2419

The NSPersistentContainer has a persistentStoreDescriptions property.

That array describes the stores loaded in the coordinator, including their URL.

Upvotes: 6

Related Questions