---
title: "save(_:completionHandler:)"
framework: cloudkit
role: symbol
role_heading: Instance Method
path: "cloudkit/ckdatabase/save(_:completionhandler:)-3tatz"
---

# save(_:completionHandler:)

Saves a specific record.

## Declaration

```swift
func save(_ record: CKRecord, completionHandler: @escaping @Sendable (CKRecord?, (any Error)?) -> Void)
```

## Parameters

- `record`: The record to save.
- `completionHandler`: The closure to execute after CloudKit saves the record.

## Discussion

Discussion The completion handler takes the following parameters: The saved record (as it appears on the server), or nil if there’s an error. An error if a problem occurs, or nil if CloudKit successfully saves the record. The save succeeds only when the specified record is new, or is a more recent version than the one on the server. For information on a more convenient way to save records, see modifyRecords(saving:deleting:savePolicy:atomically:).

## See Also

### Modifying Records

- [modifyRecords(saving:deleting:savePolicy:atomically:)](cloudkit/ckdatabase/modifyrecords(saving:deleting:savepolicy:atomically:).md)
- [modifyRecords(saving:deleting:savePolicy:atomically:completionHandler:)](cloudkit/ckdatabase/modifyrecords(saving:deleting:savepolicy:atomically:completionhandler:).md)
- [CKModifyRecordsOperation.RecordSavePolicy](cloudkit/ckmodifyrecordsoperation/recordsavepolicy.md)
- [delete(withRecordID:completionHandler:)](cloudkit/ckdatabase/delete(withrecordid:completionhandler:).md)
