<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKModifyRecordsOperation/savePolicy",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CKModifyRecordsOperation(py)savePolicy"
  },
  "title" : "savePolicy"
}
-->

# savePolicy

The policy to use when saving changes to records.

```
var savePolicy: CKModifyRecordsOperation.RecordSavePolicy { get set }
```

## Discussion

The server uses this property to determine how to proceed when saving record changes. The exact behavior depends on the policy you choose:

- Use [`CKModifyRecordsOperation.RecordSavePolicy.ifServerRecordUnchanged`](/documentation/CloudKit/CKModifyRecordsOperation/RecordSavePolicy/ifServerRecordUnchanged) to only save a record when the change tag of the local copy matches that of the server’s copy. If the server record’s change tag is more recent, CloudKit discards the save and returns a [`CKError.Code.serverRecordChanged`](/documentation/CloudKit/CKError/Code/serverRecordChanged) error.
- Use [`CKModifyRecordsOperation.RecordSavePolicy.changedKeys`](/documentation/CloudKit/CKModifyRecordsOperation/RecordSavePolicy/changedKeys) to save only the fields of the record that contain changes. The server doesn’t compare record change tags when using this policy.
- Use [`CKModifyRecordsOperation.RecordSavePolicy.allKeys`](/documentation/CloudKit/CKModifyRecordsOperation/RecordSavePolicy/allKeys) to save every field of the record, even those without changes. The server doesn’t compare record change tags when using this policy.

If you change the property’s value, do so before you execute the operation or submit the operation to a queue. The default value is [`CKModifyRecordsOperation.RecordSavePolicy.ifServerRecordUnchanged`](/documentation/CloudKit/CKModifyRecordsOperation/RecordSavePolicy/ifServerRecordUnchanged).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)