---
title: "yield(with:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/asyncstream/continuation/yield(with:)"
---

# yield(with:)

Resume the task awaiting the next iteration point by having it return normally from its suspension point with a given result’s success value.

## Declaration

```swift
@discardableResult func yield(with result: sending Result<Element, Never>) -> AsyncStream<Element>.Continuation.YieldResult
```

## Parameters

- `result`: A result to yield from the continuation.

## Return Value

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

## Discussion

Discussion If nothing is awaiting the next value, the method attempts to buffer the result’s element. If you call this method repeatedly, each call returns immediately, without blocking for any awaiting consumption from the iteration.

## See Also

### Producing Elements

- [yield(_:)](swift/asyncstream/continuation/yield(_:).md)
- [yield()](swift/asyncstream/continuation/yield().md)
- [AsyncStream.Continuation.YieldResult](swift/asyncstream/continuation/yieldresult.md)
