Contents

delete(withRecordID:completionHandler:)

Deletes a specific record.

Declaration

func delete(withRecordID recordID: CKRecord.ID, completionHandler: @escaping  @Sendable (CKRecord.ID?, (any Error)?) -> Void)
func deleteRecord(withID recordID: CKRecord.ID) async throws -> CKRecord.ID

Parameters

  • recordID:

    The identifier of the record to delete.

  • completionHandler:

    The closure to execute after CloudKit deletes the record.

Discussion

The completion handler takes the following parameters:

  • The identifier of the deleted record, or nil if there’s an error.

  • An error if a problem occurs, or nil if CloudKit successfully deletes the record.

Deleting a record may cause additional deletions if other records in the database reference the deleted record. CloudKit doesn’t provide the identifiers of any additional records it deletes.

For information on a more convenient way to delete records, see modifyRecords(saving:deleting:savePolicy:atomically:).

See Also

Modifying Records