Skip to content

Instance Method

flatten(on:)

Converts a collection of EventLoopFuture<Void>s to an EventLoopFuture<Void>.
func flatten(on eventLoop: any EventLoop) -> EventLoopFuture<Void>

Parameters

eventLoop

The event-loop to succeed the futures on.

Return Value

The succeeded future.

Discussion

Acts as a helper for the EventLoop.flatten(_:[EventLoopFuture<Value>]) method.

let futures = [el.future(1), el.future(2), el.future(3), el.future(4)]
let flattened = futures.flatten(on: el)
// flattened: EventLoopFuture<Void>