Instance Method


Collects all received elements, and emits a single array of the collection when the upstream publisher finishes.


func collect() -> Publishers.Collect<Publishers.TryRemoveDuplicates<Upstream>>

Return Value

A publisher that collects all received items and returns them as an array upon completion.


If the upstream publisher fails with an error, this publisher forwards the error to the downstream receiver instead of sending its output. This publisher requests an unlimited number of elements from the upstream publisher. It only sends the collected array to its downstream after a request whose demand is greater than 0 items. Note: This publisher uses an unbounded amount of memory to store the received values.