Functions
The following functions are available globally.
-
Waits on an array of
Promises and returns aPromisethat is fulfilled with an array of the resulting fulfilled values.The value of the returned
Promiseis an array of the same length as the input array and where each element in the resulting array corresponds to the same element in the input array.If any input
Promiseis rejected, the resultingPromiseis rejected with the same error. If any inputPromiseis cancelled, the resultingPromiseis cancelled. If multiple inputPromises are rejected or cancelled, the first such one determines how the returnedPromisebehaves.Declaration
Parameters
promisesqosThe QoS to use for the dispatch queues that coordinate the work. The default value is
.default.cancelOnFailure -
Waits on a tuple of
Promises and returns aPromisethat is fulfilled with a tuple of the resulting values.The value of the returned
Promiseis an tuple where each element in the resulting tuple corresponds to the same element in the input tuple.If any input
Promiseis rejected, the resultingPromiseis rejected with the same error. If any inputPromiseis cancelled, the resultingPromiseis cancelled. If multiple inputPromises are rejected or cancelled, the first such one determines how the resultingPromisebehaves.Declaration
Swift
public func when<Value1,Value2,Value3,Value4,Value5,Value6,Error>(fulfilled a: Promise<Value1,Error>, _ b: Promise<Value2,Error>, _ c: Promise<Value3,Error>, _ d: Promise<Value4,Error>, _ e: Promise<Value5,Error>, _ f: Promise<Value6,Error>, qos: DispatchQoS.QoSClass = .default, cancelOnFailure: Bool = false) -> Promise<(Value1,Value2,Value3,Value4,Value5,Value6),Error>Parameters
abcdefqosThe QoS to use for the dispatch queues that coordinate the work. The default value is
.default.cancelOnFailure -
Waits on a tuple of
Promises and returns aPromisethat is fulfilled with a tuple of the resulting values.The value of the returned
Promiseis an tuple where each element in the resulting tuple corresponds to the same element in the input tuple.If any input
Promiseis rejected, the resultingPromiseis rejected with the same error. If any inputPromiseis cancelled, the resultingPromiseis cancelled. If multiple inputPromises are rejected or cancelled, the first such one determines how the resultingPromisebehaves.Declaration
Swift
public func when<Value1,Value2,Value3,Value4,Value5,Error>(fulfilled a: Promise<Value1,Error>, _ b: Promise<Value2,Error>, _ c: Promise<Value3,Error>, _ d: Promise<Value4,Error>, _ e: Promise<Value5,Error>, qos: DispatchQoS.QoSClass = .default, cancelOnFailure: Bool = false) -> Promise<(Value1,Value2,Value3,Value4,Value5),Error>Parameters
abcdeqosThe QoS to use for the dispatch queues that coordinate the work. The default value is
.default.cancelOnFailure -
Waits on a tuple of
Promises and returns aPromisethat is fulfilled with a tuple of the resulting values.The value of the returned
Promiseis an tuple where each element in the resulting tuple corresponds to the same element in the input tuple.If any input
Promiseis rejected, the resultingPromiseis rejected with the same error. If any inputPromiseis cancelled, the resultingPromiseis cancelled. If multiple inputPromises are rejected or cancelled, the first such one determines how the resultingPromisebehaves.Declaration
Parameters
abcdqosThe QoS to use for the dispatch queues that coordinate the work. The default value is
.default.cancelOnFailure -
Waits on a tuple of
Promises and returns aPromisethat is fulfilled with a tuple of the resulting values.The value of the returned
Promiseis an tuple where each element in the resulting tuple corresponds to the same element in the input tuple.If any input
Promiseis rejected, the resultingPromiseis rejected with the same error. If any inputPromiseis cancelled, the resultingPromiseis cancelled. If multiple inputPromises are rejected or cancelled, the first such one determines how the resultingPromisebehaves.Declaration
Parameters
abcqosThe QoS to use for the dispatch queues that coordinate the work. The default value is
.default.cancelOnFailure -
Waits on a tuple of
Promises and returns aPromisethat is fulfilled with a tuple of the resulting values.The value of the returned
Promiseis an tuple where each element in the resulting tuple corresponds to the same element in the input tuple.If any input
Promiseis rejected, the resultingPromiseis rejected with the same error. If any inputPromiseis cancelled, the resultingPromiseis cancelled. If multiple inputPromises are rejected or cancelled, the first such one determines how the resultingPromisebehaves.Declaration
Parameters
abqosThe QoS to use for the dispatch queues that coordinate the work. The default value is
.default.cancelOnFailure -
Returns a
Promisethat is resolved with the result of the first resolved inputPromise.The first input
Promisethat is either fulfilled or rejected causes the resultingPromiseto be fulfilled or rejected. An inputPromisethat is cancelled is ignored. If all inputPromises are cancelled, the resultingPromiseis cancelled.Declaration
Parameters
promisesAn array of
Promises.cancelRemaining
View on GitHub
Functions Reference