Collects elements by a given strategy, and emits a single array of the collection.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Framework
- Combine
Declaration
func collect<S>(_ strategy: Publishers.Time Grouping Strategy<S>, options: S.SchedulerOptions? = nil) -> Publishers.Collect By Time<Publishers.Try Last Where<Upstream>, S> where S : Scheduler
Parameters
strategy
The strategy with which to collect and publish elements.
options
Scheduler
options to use for the strategy.
Return Value
A publisher that collects elements by a given strategy, and emits a single array of the collection.
Discussion
If the upstream publisher finishes before filling the buffer, this publisher sends an array of all the items it has received. This may be fewer than count
elements. If the upstream publisher fails with an error, this publisher forwards the error to the downstream receiver instead of sending its output. Note: When this publisher receives a request for .max(n)
elements, it requests .max(count * n)
from the upstream publisher.