← back to the blog


How to clear Core Data store/objects from device, Delete Core Data data Swift UI

Posted on February 22nd, 2020 in Swift by George

 

If you are developing with Core Data chances are you have added some object and then you have modified the model of the Entity. Now you have errors in XCode and you want to clear all the objects from Core Data persistent storage.

The best and easiest way to clear the persistent store in Core Data is to delete the application from the ios Simulator and build again. 

See screenshot examples below: 

 

1. First, we add 4 objects with Core Data and then list them.

 

2. Then navigate to the Apps screen and delete the app, take notice of the warning popup.

 

3. All done. Now build the application again from the XCode and you will see that Core Data is clear.

 

 

Thank you!