I am a little confused as to how to delete all core data in swift. I have created a button with an IBAction linked. On the click of the button I have the follow
For Swift 3.0
func DeleteAllData(){
let appDelegate = UIApplication.shared.delegate as! AppDelegate
let managedContext = appDelegate.persistentContainer.viewContext
let DelAllReqVar = NSBatchDeleteRequest(fetchRequest: NSFetchRequest(entityName: "Entity"))
do {
try managedContext.execute(DelAllReqVar)
}
catch {
print(error)
}
}