Skip to content

Instantly share code, notes, and snippets.

@roymckenzie
Last active January 27, 2017 17:36
Show Gist options
  • Save roymckenzie/0905cbdd50ffd085402542128fc4d32d to your computer and use it in GitHub Desktop.
Save roymckenzie/0905cbdd50ffd085402542128fc4d32d to your computer and use it in GitHub Desktop.
Private Database Subscription
import CloudKit
// Create subscription with an internal identifier
let subscription = CKDatabaseSubscription(subscriptionID: "internalSubscriptionIdentifier")
// Create an operation to save the subscription
let operation = CKModifySubscriptionsOperation(subscriptionsToSave: [subscription],
subscriptionIDsToDelete: nil)
// Add the operation to the private database
CKContainer.default()
.privateCloudDatabase
.add(operation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment