<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKDatabase/modifySubscriptions(saving:deleting:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "s:So10CKDatabaseC8CloudKitE19modifySubscriptions6saving8deleting17completionHandlerySaySo14CKSubscriptionCG_SaySSGys6ResultOySDySSAMyAIs5Error_pGG11saveResults_SDySSAMyytsAN_pGG06deleteN0tsAN_pGctF"
  },
  "title" : "modifySubscriptions(saving:deleting:completionHandler:)"
}
-->

# modifySubscriptions(saving:deleting:completionHandler:)

Modifies the specified subscriptions and delivers the results to a completion handler.

```
@preconcurrency func modifySubscriptions(saving subscriptionsToSave: [CKSubscription], deleting subscriptionIDsToDelete: [CKSubscription.ID], completionHandler: @escaping @Sendable (Result<(saveResults: [CKSubscription.ID : Result<CKSubscription, any Error>], deleteResults: [CKSubscription.ID : Result<Void, any Error>]), any Error>) -> Void)
```

## Parameters

`subscriptionsToSave`

The subscriptions to save.

`subscriptionIDsToDelete`

The identifiers of the subscriptions to permanently delete.

`completionHandler`

The closure to execute after CloudKit processes the changes.

## Discussion

The completion handler takes a single <doc://com.apple.documentation/documentation/Swift/Result> parameter that contains either a tuple, or an error if the request fails. For example, when the network is unavailable or the device doesn’t have an active iCloud account.

When present, the tuple contains the following named elements:

- `saveResults`: A dictionary of saved subscriptions. The dictionary uses the identifiers of the subscriptions you specify in `subscriptionsToSave` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/Swift/Result> that contains either the corresponding modified subscription (as it appears on the server), or an error that describes why CloudKit can’t modify that subscription.
- `deleteResults`: A dictionary of deleted subscriptions. The dictionary uses the identifiers you specify in `subscriptionIDsToDelete` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/Swift/Result> that contains either <doc://com.apple.documentation/documentation/Swift/Void> to indicate a successful deletion, or an error that describes why CloudKit can’t delete that subscription.

For information on a more configurable way to modify subscriptions, see [`CKModifySubscriptionsOperation`](/documentation/CloudKit/CKModifySubscriptionsOperation).

---

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)