yield(_:)

Resume the task awaiting the next iteration point by having it return normally from its suspension point with a given element.

iOS
13.0+
macOS
10.15+
tvOS
13.0+
watchOS
6.0+
@discardableResult func yield(_ value: sending Element) -> AsyncStream<Element>.Continuation.YieldResult

Parameters

value

The value to yield from the continuation.

Returns

A YieldResult that indicates the success or failure of the yield operation.

If nothing is awaiting the next value, this method attempts to buffer the result’s element.

This can be called more than once and returns to the caller immediately without blocking for any awaiting consumption from the iteration.