DeleteAll ParseObjects

Hello,

I am sorry for what seems like a basic question but I am very new to ParseSwift.
how can i delete all records like in other SDK? other than the current solution that comes to mind is running it via cloud code as my custom parseObjects has as ParseFile and I would like to erase the object and any referencing files.

Edit:
After some tinkering around i found a solution that works but I’m not so sure that its the correct way. if anyone can shed some light I would be grateful.

I have a custom ParseObject called ParseCandidate

ParseCandidate.query.find().deleteAll{ response in
  //do something with response
}

This gets the job done but I am quit certain that any attached ParseFile will not be deleted and I will have to do some housekeeping to delete unreferenced files.

thank you.

The playgrounds demonstrate how to use most the SDKs functionality. DeleteAll is here:

Deleting a file is similar to the other SDKs and requires the masterKey which the documentation states. This type of functionality should only be used server side. To use the Swift SDK for cloud code see here:

Thank you @cbaker6

Believe i went through the playgrounds multiple times before posting this question but must have skimmed right past it.

I just have a one question though. it seems to me that this method is iterating through the array and deleting on object at a time. if i call this method from a local device will this be all accomplished on one api call or multiples, Now i am certain if this was run on cloud code its one api call to the server then the server does it thing and sends the response back.

Thanks again for shedding some light.

All of the SDK is documented. You can see the documentation for a method or property by right clicking in Xcode. For deleteAll everything is “batched” meaning all objects in the array are sent to the server based on the batched limit. As long as your array is smaller/equal to the batch limit everything is sent at once. The same thing occurs when using the JS SDK and Cloud Cloud:

I have a follow up question. I have managed to setup the deleteAll() however I have an object that has many children. Is there a way to include all children in the delete process?

Thank you

I don’t believe the server supports this out-of-the-box. You will need to create a custom cloud code method. You can either create the cloud in JS or using Swift.