Instance Method


Deletes the specified record asynchronously, with a low priority, from the current database.


func delete(withRecordID recordID: CKRecord.ID, completionHandler: @escaping (CKRecord.ID?, Error?) -> Void)



The ID of the record you want to delete. This method throws an exception if this parameter is nil.


The block to execute with the results. Your block must be capable of running on any thread of the app and must take the following parameters:


The ID of the record you attempted to delete.


An error object, or nil if the record was deleted successfully. Use the information in the error object to determine whether a problem has a workaround.


Deleting a record may trigger additional deletions if the record was referenced by other records. This method reports only the ID of the record you asked to delete. CloudKit does not report deletions triggered by owning relationships between records.

This method deletes the record with a low priority, which may cause the task to execute after higher-priority tasks. To delete records more urgently, create a CKModifyRecordsOperation object with the desired priority. You can also use that operation object to delete multiple records simultaneously.

See Also

Accessing Records

func fetch(withRecordID: CKRecord.ID, completionHandler: (CKRecord?, Error?) -> Void)

Fetches one record asynchronously, with a low priority, from the current database.

func save(CKRecord, completionHandler: (CKRecord?, Error?) -> Void)

Saves one record asynchronously, with a low priority, to the current database, if the record has never been saved or if it is newer than the version on the server.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software