I'm new to PromiseKit and I'm a bit confused to how to handle multiple promises. I'm using CloudKit and saving two records, and when they are both saved, I want to do something on completion and something else on error. I thought I should do the following, but Xcode is complaining so obviously I must have misunderstood:
let savePromise1 : PMKPromise = db.saveRecord(record1)
let savePromise2 : PMKPromise = db.saveRecord(record2)
PMKPromise.when([ savePromise1, savePromise2 ]).then() { results in
// handle success or errors
}
The error I get is "Cannot convert the experssion's type '(($T8) -> ($T8) -> $T7) -> (($T8) -> ($T7) -> $T7' to type 'PMKPromise'
I don't really understand what the error means, but I was expecting "results" to be an array of (result, error) tuples.
How should I write my "when" statement instead?
Cheers
Nik