I create 2 operations, let's say CKModifySubscriptionsOperation. One is for private, another for shared database. I could queue them by adding to the OperationQueue, each next would start after previous completion block.
let operationQueue = OperationQueue()
operationQueue.maxConcurrentOperationCount = 1
// ...
operationQueue.addOperation(operation)
// Queued great but all subscriptions are created in private database
But I need to do some action (fetching, modifying etc) from different databases, but still need to queue them. Here is how I add operation to the database. How to put them to the single queue but still let them go to needed database each?
container.privateCloudDatabase.add(operation)
container.sharedCloudDatabase.add(operation)
// Put subscriptions to correct databases but no queue
I've solved the goal by creating a controlled custom operation.
Now we can queue cloud database specific operations just like that
First of all, parent class
And then we can create any database operation (subscription in this example but will work with any)