Functions
The following functions are available globally.
-
Waits on an array of
Promise
s and returns aPromise
that is fulfilled with an array of the resulting fulfilled values.The value of the returned
Promise
is 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
Promise
is rejected, the resultingPromise
is rejected with the same error. If any inputPromise
is cancelled, the resultingPromise
is cancelled. If multiple inputPromise
s are rejected or cancelled, the first such one determines how the returnedPromise
behaves.Declaration
Parameters
promises
qos
The QoS to use for the dispatch queues that coordinate the work. The default value is
.default
.cancelOnFailure
-
Waits on a tuple of
Promise
s and returns aPromise
that is fulfilled with a tuple of the resulting values.The value of the returned
Promise
is an tuple where each element in the resulting tuple corresponds to the same element in the input tuple.If any input
Promise
is rejected, the resultingPromise
is rejected with the same error. If any inputPromise
is cancelled, the resultingPromise
is cancelled. If multiple inputPromise
s are rejected or cancelled, the first such one determines how the resultingPromise
behaves.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
a
b
c
d
e
f
qos
The QoS to use for the dispatch queues that coordinate the work. The default value is
.default
.cancelOnFailure
-
Waits on a tuple of
Promise
s and returns aPromise
that is fulfilled with a tuple of the resulting values.The value of the returned
Promise
is an tuple where each element in the resulting tuple corresponds to the same element in the input tuple.If any input
Promise
is rejected, the resultingPromise
is rejected with the same error. If any inputPromise
is cancelled, the resultingPromise
is cancelled. If multiple inputPromise
s are rejected or cancelled, the first such one determines how the resultingPromise
behaves.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
a
b
c
d
e
qos
The QoS to use for the dispatch queues that coordinate the work. The default value is
.default
.cancelOnFailure
-
Waits on a tuple of
Promise
s and returns aPromise
that is fulfilled with a tuple of the resulting values.The value of the returned
Promise
is an tuple where each element in the resulting tuple corresponds to the same element in the input tuple.If any input
Promise
is rejected, the resultingPromise
is rejected with the same error. If any inputPromise
is cancelled, the resultingPromise
is cancelled. If multiple inputPromise
s are rejected or cancelled, the first such one determines how the resultingPromise
behaves.Declaration
Parameters
a
b
c
d
qos
The QoS to use for the dispatch queues that coordinate the work. The default value is
.default
.cancelOnFailure
-
Waits on a tuple of
Promise
s and returns aPromise
that is fulfilled with a tuple of the resulting values.The value of the returned
Promise
is an tuple where each element in the resulting tuple corresponds to the same element in the input tuple.If any input
Promise
is rejected, the resultingPromise
is rejected with the same error. If any inputPromise
is cancelled, the resultingPromise
is cancelled. If multiple inputPromise
s are rejected or cancelled, the first such one determines how the resultingPromise
behaves.Declaration
Parameters
a
b
c
qos
The QoS to use for the dispatch queues that coordinate the work. The default value is
.default
.cancelOnFailure
-
Waits on a tuple of
Promise
s and returns aPromise
that is fulfilled with a tuple of the resulting values.The value of the returned
Promise
is an tuple where each element in the resulting tuple corresponds to the same element in the input tuple.If any input
Promise
is rejected, the resultingPromise
is rejected with the same error. If any inputPromise
is cancelled, the resultingPromise
is cancelled. If multiple inputPromise
s are rejected or cancelled, the first such one determines how the resultingPromise
behaves.Declaration
Parameters
a
b
qos
The QoS to use for the dispatch queues that coordinate the work. The default value is
.default
.cancelOnFailure
-
Returns a
Promise
that is resolved with the result of the first resolved inputPromise
.The first input
Promise
that is either fulfilled or rejected causes the resultingPromise
to be fulfilled or rejected. An inputPromise
that is cancelled is ignored. If all inputPromise
s are cancelled, the resultingPromise
is cancelled.Declaration
Parameters
promises
An array of
Promise
s.cancelRemaining