title: How To Delete all Entity Objects in CoreData Swift 3
body: <p>So I have this code which works fine, but I want a much better one.</p>
  
  <pre><code>func deleteCoreDataObjects() {
      let context = (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
  
      //where groupData is an Array of an Entity
      for i in 0..&lt;self.groupData.count {
          context.delete(groupData[i])
      }
  
  
      (UIApplication.shared.delegate as! AppDelegate).saveContext()
  
  }
  </code></pre>
  
  <p>Currently I'm deleting the objects one by one via for loop.</p>